Προς το περιεχόμενο

lighttpd localhost rewrite rules για Wordpress permalinks, σε Windows


Προτεινόμενες αναρτήσεις

Δημοσ.

Έχει καταφέρει κανείς να κάνει το Wordpress να λειτουργήσει με custom permalinks τοπικά, σε Windows με lighttpd?

 

Για να το εξηγήσω λίγο καλύτερα, μέχρι στιγμής όλα μου τα projects τα αναπτύσσω τοπικά σε xampp, το οποίο έρχεται με apache server και κατόπιν τα ανεβάζω online (προφανώς σε apache).

 

Όταν στήσουμε πάνω στο xampp το Wordrpess και ενεργοποιήσουμε τα permalinks, το Wordpress είναι από μαμά φτιαγμένο να ενημερώνει το .htaccess αρχείο με τα κατάλληλα rewrite rules του apache.

 

Επειδή αυξάνονται ολοένα και στην χώρα μας οι hosts που χρησιμοποιούν lighttpd αντί για apache, δοκίμασα να τρέξω τοπικά ένα γυμνό Wordpress πάνω σε lighttpd αντί για apache. Δυστυχώς, ότι και να δοκίμασα από τα sample rewrite rules που βρήκα στο Internet για Wordpress, δεν έχω καταφέρει να το κάνω να δουλέψει με permalink που δεν περιέχει μέσα του το index.php.

 

Για παράδειγμα, βάζω το wordpress στο: lighttpd\htdocs\wp\36\base\

το φορτώνω με: http://localhost/wp/36/base/ και όλα ωραία και καλά. Δεν χρειάζεται κανένα rewrite rule. Ακόμα κι αν χρησιμοποιήσω κάποιο από τα έτοιμα permalink formats που δίνει (που έχουν όλα μέσα τους το index.php, π.χ.: http://localhost/wp/36/base/index.php/%postname%/) δουλεύει μια χαρά χωρίς ανάγκη ειδικών rewrite rules.

 

Μόλις αφαιρέσω το index.php από το permalink format, όταν δηλαδή ορίσω ως custom permalinks π.χ. το: http://localhost/wp/36/base/%postname%/, τότε παύει να λειτουργεί. Έχω δοκιμάσει ότι lighttpd rewrite rule έχω βρει τις τελευταίες 2 ημέρες για Wordpress permalinks και δεν δουλεύει κανένα.

 

Έχει κανείς καμια ιδέα για το τι παίζει;

 

Έλεγα μήπως από εδώ και πέρα πρότεινα στους πελάτες μου hosts με lighttpd αντί για apache, αλλά προφανώς αν δεν βρω λύση στο παραπάνω δεν πρόκειται να το ρισκάρω (ίσως να φταίω κι εγώ, δεν ξέρω, ίσως να μην ρυθμίζω σωστά δηλαδή τον lighttpd, αλλά νομίζω πως έχω ενεργοποιήσει όλα τα απαραίτητα mods... αλλιώς υποθέτω δεν θα επαιζε καν το wordpress).

Δημοσ.

Όταν λες ότι αυξάνονται οι webhosts με Lighttpd στην Ελλάδα δεν νομίζω να ισχύει. Ούτε στην Ελλάδα βασικά ούτε στο εξωτερικό. Νομίζω στην Ελλάδα είμαστε (CretaForce) ο μοναδικός webhost που δίνει shared hosting με Lighttpd.

 

Τα rewrites σε Lighttpd μπορείς να τα κάνεις με δύο τρόπους. Ο ένας είναι με Lighttpd rewrites και ο άλλος με Lua rewrites. Για τον δεύτερο τρόπο θα βρεις οδηγίες στο:

 

http://www.cretaforce.gr/blog/630-lighttpd-rewrites-wordpress

Δημοσ.

Ευχαριστώ για το λινκ με τις οδηγίες, δυστυχώς όμως δεν κατάφερα να το κάνει να δουλέψει (εννοείται πως προσάρμοσα τα paths και άνοιξα και το magnet_mod).

 

Υποτίθεται πως ο lighttpd για Windows του WLPM έχει γίνει compiled με lua support από τις [ 2012-02-07 - Release 3 / Tag: 1.4.30-3 ], οπότε υποθέτω πως δεν χρειάζεται να έχω εγκατεστημένη lua στο μηχανάκι μου, έτσι δεν είναι;

 

Το μόνο που δεν έχω ενεργοποιημένο είναι το fast-cgi, διότι δοκίμασα να το ανοίξω και μου χτύπαγε (αν θυμάμαι καλά ότι οδηγίες βρήκα ήταν για linux/unix). Σημείωση πως δεν έχω εγκαταστήσει το WLMP ως πακέτο, αλλά μόνο τον lighttpd (στην άνευ installer μορφή του). Τον έχω βάλει σε δικό του φάκελο, και έχω βάλει στο conf του να τραβάει την php από τον φάκελο του XAMPP. Τον έχω αφήσει επίσης να ακούει στην ίδια πόρτα με τον apache του XAMPP (80), οπότε κλείνω τον apache από το control-panel του XAMPP και τρέχω (τερματίζω) τον lighttpd από command-line όποτε θέλω να κάνω δοκιμές. Για mysql server τρέχω του XAMPP.

 

Τέλος, για root χρησιμοποιώ τον htdocs/ του lighttpd (δεν τον μπερδεύω δηλαδή με τον htdocs/ του apache, αυτόν τον χρησιμοποιώ όταν τρέχω τον apache από το XAMPP).

 

Παραθέτω και τα conf αρχεία μου σε περίπτωση που ασχοληθεί κάποιος για βοήθεια (τα υπόλοιπα conf αρχεία είναι τα default που έρχονται με το κατέβασμα του lighttpd από το link που έχω παραθέσει παραπάνω).

Σημείωση: Όλα τα .conf αρχεία βρίσκονται από μαμά στον φάκελο: C:\lighttpd\conf Εκεί τα έχω αφήσει κι εγώ (με εξαίρεση το προτεινόμενο: wordpress.lua που το έβαλα έξω από τον conf/ και προσάρμοσα κατάλληλα το path στο τέλος του lighttpd.conf... αν και παρακάτω το έχω disabled, με comment).

 

lighttpd.conf:

 

 

# LightTPD Configuration file (CORE)
#
# Use it as a base for LightTPD 1.0.0 and above.
# This version is built by WLMP Project - http://en.wlmp.project.net/
#
# $Id: lighttpd.conf,v 1.8 2012/02/07 19:30:32 dtech Exp $

############ Options you really have to take care of ####################

## modules to load
# at least mod_access and mod_accesslog should be loaded
# all other module should only be loaded if really neccesary
# - saves some time
# - saves memory
server.modules              = (
# MIGF1: these are the defaults that came with the download
                                "mod_access",
                                "mod_accesslog",
#                              "mod_alias",
#                               "mod_auth",
#                              "mod_cgi",
#                               "mod_cml",
#                               "mod_compress",
#                               "mod_evasive",
#                               "mod_evhost",
#                              "mod_expire",
#                               "mod_extforward",
#                               "mod_fastcgi",
#                               "mod_flv_streaming",
#                               "mod_magnet",
#                               "mod_mysql_vhost",
#                               "mod_proxy",
#                               "mod_redirect",
#                              "mod_rewrite",
#                               "mod_rrdtool",
#                               "mod_scgi",
#                               "mod_secdownload",
#                               "mod_setenv",
#                               "mod_simple_vhost",
#                               "mod_ssi",
                               "mod_status",
#                               "mod_trigger_b4_dl",
#                               "mod_userdir",
#                               "mod_usertrack",
#                               "mod_webdav"
# MIGF1: here are my experimentations
    "mod_rewrite",
    "mod_redirect",
    "mod_alias",
#   "mod_access",
    "mod_auth",
#    "mod_status",
    "mod_simple_vhost",
    "mod_evhost",
    "mod_userdir",
    "mod_secdownload",
    "mod_fastcgi",
    "mod_magnet",
    "mod_proxy",
    "mod_cgi",
    "mod_ssi",
    "mod_compress",
    "mod_usertrack",
    "mod_expire",
#    "mod_rrdtool",
#    "mod_accesslog" 
                               )

#### include important configuration files
## include path variables
include "variables.conf"
## include mimetype mapping file
include "mimetype.conf"
## include virtual hosts (optional)
#include "vhosts.conf"
#MIGF1:
include "server-tag.conf"

## a static document-root, for virtual-hosting take look at the
## server.virtual-* options
server.document-root        = server_root + "/htdocs"
# MIGF1: server.document-root        = "C:/xampp/htdocs"

#directory for file uploads
server.upload-dirs          = ( temp_dir )

# files to check for if .../ is requested
index-file.names            = ( "index.php", "index.pl", "index.cgi", "index.cml",
                                "index.html", "index.htm", "default.htm" )

## set the event-handler (read the performance section in the manual)
server.event-handler        = "libev"

## deny access the file-extensions
#
# ~    is for backupfiles from vi, emacs, joe, ...
# .inc is often used for code includes which should in general not be part
#      of the document-root
url.access-deny             = ( "~", ".inc" )

## disable range request for PDF files
$HTTP["url"] =~ "\.pdf$" {
  server.range-requests = "disable"
}

## static-file module
# which extensions should not be handle via static-file transfer
#
# .php, .pl, .fcgi are most often handled by mod_fastcgi or mod_cgi
static-file.exclude-extensions = ( ".php", ".pl", ".cgi" )

######### Options that are good to be but not neccesary to be changed #######

## enable ipv6 usage
#server.use-ipv6            = "enable"

## bind to port (default: 80)
#server.port                = 80

## bind to localhost (default: all interfaces)
#server.bind                = "mydomain.org"


###### virtual hosts
##
##  If you want name-based virtual hosting add the next three settings and load
##  mod_simple_vhost
##
## document-root =
##   virtual-server-root + virtual-server-default-host + virtual-server-docroot
## or
##   virtual-server-root + http-host + virtual-server-docroot
##
#simple-vhost.server-root   = server_root
#simple-vhost.default-host  = "vhost.mydomain.org"
#simple-vhost.document-root = "/vhosts"

## alias module
#alias.url                  = ( "/documentation" => "manual" )
#MIGF1 added the following
alias.url                   += ( "/phpmyadmin/" => "C:/xampp/phpMyAdmin/" )

## custom error pages
## Format: <errorfile-prefix><status-code>.html
## -> ..../status-404.html for 'File not found'
#server.errorfile-prefix    = "errors/status-"

## error-handler for status 404
#server.error-handler-404   = "/error-handler.html"
#server.error-handler-404   = "/error-handler.php"

## virtual directory listings
dir-listing.activate        = "enable"
#dir-listing.encoding       = "utf-8"
#dir-listing.external-css   = server_root + "style/style.css"

## enable debugging
#debug.log-request-header   = "enable"
#debug.log-response-header  = "enable"
#debug.log-request-handling = "enable"
#debug.log-file-not-found   = "enable"

#### compress module
#compress.cache-dir         = temp_dir + "/cache/compress"
#compress.filetype          = ("text/plain", "text/html")

#### proxy module
## read proxy.txt for more info
#proxy.server               = ( ".php" =>
#                               ( "localhost" =>
#                                 (
#                                   "host" => "192.168.0.101",
#                                   "port" => 80
#                                 )
#                               )
#                             )

#### fastcgi module
## read fastcgi.txt for more info
## for PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini
## ... and PHP_FCGI_MAX_REQUESTS = 0 environment variable in system properties
#fastcgi.server             = ( ".php" =>
#                               ( "localhost" =>
#                                 (
#                                   "host" => "127.0.0.1",
#                                   "port" => 9000
#                                 )
#                               )
#                             )

## map multiple extensions to the same fastcgi server
#MIGF1 enabled the following
#fastcgi.map-extensions     = ( ".php3" => ".php",
#                               ".php4" => ".php" )

#### CGI module
#MIGF1 enabled the following
cgi.assign                 = ( ".php" => "C:/xampp/PHP/php-cgi.exe",
                               ".pl"  => "C:/xampp/Perl/bin/perl.exe",
                               ".cgi" => "C:/xampp/Perl/bin/perl.exe" )

#### SSL engine
#ssl.engine                 = "enable"
#ssl.pemfile                = cert_dir + "/server.pem"

#### status module
status.status-url           = "/server-status"
status.config-url           = "/server-config"
## fcgi statistics
#status.statistics-url      = "/server-counters"

#### auth module
## read authentication.txt for more info
#auth.backend               = "plain"
#auth.backend.plain.userfile = conf_dir + "/auth.user"
#auth.backend.plain.groupfile = conf_dir + "/auth.group"

#auth.backend.ldap.hostname = "localhost"
#auth.backend.ldap.base-dn  = "dc=my-domain,dc=com"
#auth.backend.ldap.filter   = "(uid=$)"

#auth.require               = ( "/server-status" =>
#                               (
#                                 "method"  => "digest",
#                                 "realm"   => "Server status",
#                                 "require" => "user=admin"
#                               ),
#                               "/server-config" =>
#                               (
#                                 "method"  => "digest",
#                                 "realm"   => "Server config",
#                                 "require" => "user=admin"
#                               )
#                             )

#### url handling modules (rewrite, redirect, access)
#url.rewrite                = ( "^/$"             => "/server-status" )
#url.redirect               = ( "^/wishlist/(.+)" => "http://www.123.org/$1" )

#### both rewrite/redirect support back reference to regex conditional using %n
#$HTTP["host"] =~ "^www\.(.*)" {
#  url.redirect             = ( "^/(.*)" => "http://%1/$1" )
#}

#### evhost module
# define a pattern for the host url finding
# %% => % sign
# %0 => domain name + tld
# %1 => tld
# %2 => domain name without tld
# %3 => subdomain 1 name
# %4 => subdomain 2 name
#
#evhost.path-pattern        = server_root + "/htdocs"

#### expire module
#expire.url                 = ( "/buggy/" => "access 2 hours", "/asdhas/" => "access plus 1 seconds 2 minutes")

#### ssi
#ssi.extension              = ( ".shtml" )

#### rrdtool
#rrdtool.binary             = "C:/RRDtool/rrdtool.exe"
#rrdtool.db-name            = temp_dir + "/lighttpd.rrd"

#### setenv
#setenv.add-request-header  = ( "TRAV_ENV" => "mysql://user@host/db" )
#setenv.add-response-header = ( "X-Secret-Message" => "42" )

## for mod_trigger_b4_dl
#trigger-before-download.gdbm-filename = "C:/GDBM/testbase/trigger.db"
#trigger-before-download.memcache-hosts = ( "127.0.0.1:11211" )
#trigger-before-download.trigger-url = "^/trigger/"
#trigger-before-download.download-url = "^/download/"
#trigger-before-download.deny-url = "http://127.0.0.1/index.html"
#trigger-before-download.trigger-timeout = 10

#### for mod_cml
## don't forget to add index.cml to server.indexfiles
#cml.extension              = ".cml"
#cml.memcache-hosts         = ( "127.0.0.1:11211" )

#### mysql vhost
## unix sockets don't work under windows environment, but you can use TCP connection instead of socket
#mysql-vhost.hostname       = "127.0.0.1" # if set overrides socket
#mysql-vhost.port           = 3306
#mysql-vhost.user           = "lighttpd"
#mysql-vhost.pass           = "secret"
#mysql-vhost.db             = "lighttpd"
#mysql-vhost.sql            = "SELECT docroot FROM domains WHERE domain='?';"

#### variable usage:
## variable name without "." is auto prefixed by "var." and becomes "var.bar"
#bar = 1
#var.mystring = "foo"

## integer add
#bar += 1
## string concat, with integer cast as string, result: "www.foo1.com"
#server.name = "www." + mystring + var.bar + ".com"
## array merge
#index-file.names = (foo + ".php") + index-file.names
#index-file.names += (foo + ".php")

#### include
#include server_root + "/conf/external.conf"
## same as above if you run: "lighttpd -f conf/external.conf"
#include "external.conf"

#MIGF1
include server_root + "/conf/my_localhost.conf"
#server.error-handler-404 = "/index.php"

#MIGF1: Proposed by Cretaforce.gr
#$HTTP["url"] !~ "^/(|index.html|xcache-admin|awstatsclasses|awstatsicons|awstatscss|awstats|webmail|phpmyadmin)(/|$)" {
#	index-file.names = ( "index.php" )
#	magnet.attract-physical-path-to = ( "C:/lighttpd/wordpress.lua" )
#}

 

my-localhost.conf (διάφοροι πειραματισμοί με rewrite rules, από το Internet):

 

 

#$HTTP["host"] == "localhost" {
#        $HTTP["url"] =~ "^/wp/35/base/.*" {
#		url.rewrite-final = (
#
		# Exclude some directories from rewriting
#		"^/(wp-admin|wp-includes|wp-content|gallery2)/(.*)" => "$0",
#
		# Exclude .php files at root from rewriting
#		"^/(.*.php)" => "$0",

		# Handle permalinks and feeds
#		"^/(.*)$" => "/index.php/$1"
#       }
#}


#$HTTP["host"] =~ "(www.)?localhost/wp/35/base" {
#	url.rewrite = (
#		"^/(.*)\.(.+)$" => "$0",
#		"^/(.+)/?$" => "/index.php/$1",
#	)
#}

$HTTP["host"] =~ "(^|\.)localhost/wp/35/base$" {
   url.rewrite-once = (
      # Exclude additional specific directories from rewrites
      "^/(files)/?(.*)" => "$0",
      "^/(mysql)/?(.*)" => "$0",

      "^/(wp-.+).*/?" => "$0",
      "^/(favicon.ico)" => "$0",
      "^/(sitemap.xml)" => "$0",
      "^/(xmlrpc.php)" => "$0",
      "^/keyword/([A-Za-z_0-9-])/?$" => "index.php?keyword=$1",
      "^/(.+)/?$" => "index.php/$1"
   )  
}

 

 

ΥΓ. Νομίζω και η dnhost.gr lighttpd servers χρησιμοποιεί.

Δημοσ.

Δεν πειράζει, κι εγώ δεν θα ασχοληθώ άλλο προς το παρόν. Ευχαριστώ όμως για την συμμετοχή στο νήμα.

 

ΥΓ. Έχεις δίκιο για την dnhost.

Δημιουργήστε ένα λογαριασμό ή συνδεθείτε για να σχολιάσετε

Πρέπει να είστε μέλος για να αφήσετε σχόλιο

Δημιουργία λογαριασμού

Εγγραφείτε με νέο λογαριασμό στην κοινότητα μας. Είναι πανεύκολο!

Δημιουργία νέου λογαριασμού

Σύνδεση

Έχετε ήδη λογαριασμό; Συνδεθείτε εδώ.

Συνδεθείτε τώρα
  • Δημιουργία νέου...