我有以下简单的lighttpd
重写规则:
$HTTP["host"] =~ "^(app\.mydomain\.com)$" {
url.rewrite-once = (
"^[^.]*$" => "controller.php/$1"
)
}
我正在尝试将此规则移植到nginx
并具有以下内容:
server {
listen 80;
server_name app.mydomain.com;
if ($host = 'app.mydomain.com') {
rewrite ^[^.]*$ controller.php/$1 last;
}
root /srv/www/domains/app.mydomain.com;
index index.php;
access_log /var/log/nginx/domains/app.mydomain.com/access.log;
error_log /var/log/nginx/domains/app.mydomain.com/error.log;
include /etc/nginx/excludes.conf;
include /etc/nginx/php.conf;
include /etc/nginx/expires.conf;
}
问题是nginx的重写规则不能正常工作?知道我做错了什么吗?谢谢。