重写规则从Lighttpd-Regex转换为NginX



不太确定从哪里开始。我有这个重写规则,我们在使用lighttpd的应用程序中使用了这个规则,我们正在考虑将web服务器迁移到NginX进行标准化。

Lighttpd.conf:内的Lighttpd配置行

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

首先,有人能帮我翻译这些台词吗?我从别人那里继承了它,却不知道这意味着什么?

接下来,如何在NginX中将这些行转换为可用的配置行?我甚至不知道该向你们提供什么来帮助理解这条线。我所知道的是,当我们从lighttpd中删除这些行时,应用程序就会停止工作。我让我们的NginX在centos6.4上进行标准Php和Php-fpm的工作。当我使用phpinfo文件时,NginX能够生成信息,但当我们安装应用程序时,它在错误日志文件中出现了错误。

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"

在web浏览器上,我得到了"404未找到"错误。

同样为了保持一致性,有人能建议如何翻译这句话吗?

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

请告知我可以提供哪些额外的信息来帮助翻译?我甚至不确定这是NginX的问题还是应用程序的问题。非常感谢您的帮助。

我对lighttpd配置了解不多,你需要向我解释一下,这样我就可以用nginx格式编写它们了。

我也不知道什么会处理PHP,它是快速的cgi还是fpm,或者什么?

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;
    }
}

最新更新