0

I'm configuring lighttpd (1.4.26) for drupal on Ubuntu 10 and I've some issues with the rewrite module.

So far I have enabled the rewrite module in lighttpd.conf

Then, I have added the following lines to the configuration file (as written here http://drupal.org/node/43782).

url.rewrite-final = (
  "^/system/test/(.*)$" => "/index.php?q=system/test/$1",
  "^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2",
  "^/([^.?]*)$" => "/index.php?q=$1",
   "^/rss.xml" => "/index.php?q=rss.xml"
)

But What I get is "page not found" for any URL on my server

I also have another question: are there directory-level configuration file with lighttpd, or should I exclusively work with lighttpd.conf ?

thanks

Update I found out I can use a LUA script, but I'm afraid my lighttpd version is not compiled with the mod_magnet module, since I don't see it in the modules list in the configuration file.

$HTTP["host"] == "host.com" {
  server.document-root = "/path/to/drupal/site/"
  dir-listing.activate = "disable"
  magnet.attract-physical-path-to = ("/etc/lighttpd/drupal.lua")
}

3 Answers 3

0

I just setup up drupal on my webserver , just for you ;) Here is an example config-snippet with vhost:

$HTTP["host"] =~ "drupal\.mysite\.com$" {
        server.document-root = "/var/www/drupal/"
        url.rewrite-final = (
                "^/system/test/(.*)$" => "/index.php?q=system/test/$1",
                "^/([^.?]*)\?(.*)$" => "/index.php?q=$1&$2",
                "^/([^.?]*)$" => "/index.php?q=$1",
                "^/rss.xml" => "/index.php?q=rss.xml"
        )
}

That works (i can enable Clean URLs in drupal and it seems to work), i don't know how your config looks actually, but maybe first try to adapt my one. You have to put this at the end of your lighttpd.conf The LUA stuff should also work, all roads lead to Rome ;) But I think it's better to keep it simple and not to enable so much modules. I'm sure you'll need the rewrite module more than magnet in the future.

4
  • what If I don't have a domain name yet, just the ip address..
    – aneuryzm
    Nov 7, 2010 at 10:45
  • You have to change the HTTP field name to something like that: $SERVER["socket"] == "192.168.1.1:80"
    – zaub3r3r
    Nov 7, 2010 at 10:48
  • I saw several example on internet using exactly your line but I get this error message: 2010-11-07 13:20:06: (network.c.345) can't bind to port: 192.168.1.1 80 Cannot assign requested address ...fail!
    – aneuryzm
    Nov 7, 2010 at 13:20
  • I'm now using the external ip of my server and it works.
    – aneuryzm
    Nov 7, 2010 at 13:43
0

I assume that you've removed the '#'s. Which version of lighttpd do you use? You have to add EVERYTHING in the lighttpd.conf, sure you can include config files in the lighttpd.conf (Debian does this with the lighty-tools: lighty-enable-mod etc.), however i would advise you to stay in /etc/lighttpd/.

1
  • Ok, I've updated my question with versions. However it just give me "page not found" error over all webserver. I found another solution they suggest to use a lua script (see updated question). Should I go with this second one ?
    – aneuryzm
    Nov 7, 2010 at 10:20
0

Just in case anyone reading is considering the LUA script option, you need to install mod_magnet separately on a Debian/Ubuntu distribution. The appropriate package is called lighttpd-mod-magnet. So, you need to do this on the command-line.

apt-get install lighttpd-mod-magnet

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .