Question

Not quite sure where to start from here. I have this rewrite rule that we used for our apps using lighttpd and we're contemplating of moving the web server to NginX for standardization.

Lighttpd config line inside the lighttpd.conf:

url.rewrite-once = (
 ".*\?(.*)$" => "/index.php?$1",
 "^/js/.*$" => "$0",
 "^.*\.(js|ico|gif|jpg|png|css|swf |jar|class)$" => "$0",
 "" => "/index.php"
 )

First, can anyone help me translate those lines? I inherit it from someone else and have no idea what that means?

Next, How do I convert those lines to usable configuration line in NginX? I'm not even sure what to provide to you all to help with understanding the line. All I know is that when we remove those lines from lighttpd, the apps stop working. I have our NginX working on a standard Php with Php-fpm on centos 6.4. when I use the phpinfo file, NginX was able to generate the info but when we installed the apps it errored with this error inside the error log file.

2013/08/12 21:51:00 [error] 18844#0: *16 open() "/var/www/html/myapps/public/user/login" failed (2: No such file or directory), client: 192.168.8.100, server: _, request: "GET /user/login HTTP/1.1", host: "192.168.8.215"

and on the web browser I got "404 not found" error.

Also for consistency, can anyone suggest how to translate this line?

location / { if ( $uri !~ ^/(index\.php|css|images|core|uploads|js|robots\.txt) ) { rewrite ^ /index.php last; } } 

Please advise on additional information I can provide to help with the translation? I wasn't even sure whether this is an NginX problem or apps problem. Many thanks in advance for all of your help.

Was it helpful?

Solution

I don't really know much about lighttpd configs, you'll need to explain to me so i could write them in nginx format.

Also I don't know what will process the PHP, is it fast-cgi or fpm, or what ?

server {
    server_name example.com; #replace with your domain name
    index index.php;
    location / {
        try_files $uri $uri/ /index.php$request_uri;
    }
    location ~* \.php$ {
        include        fastcgi_params;
        fastcgi_pass   127.0.0.1:9000;

    }
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top