【发布时间】:2014-07-06 13:13:27
【问题描述】:
http://example.com/ 工作正常,但http://example.com/piwik 给我一个 404。 我不明白为什么这个配置在 Nginx 中不起作用。这是我要服务的网站:
/srv
/blog
index.php
/piwik
index.php
然后是配置文件:
server {
charset utf8;
index index.php;
server_name example.com;
root /srv/blog;
client_max_body_size 10M;
# Deny all ht file useless in nginx
location ~ /\.ht* {
deny all;
}
location /images {
alias /srv/blog/images;
}
location /piwik {
index index.php;
alias /srv/piwik;
}
location / {
try_files $uri $uri/ /index.php?$args;
}
location ~ ^(.+?\.php)(/.*)?$ {
try_files $1 = 404;
include fastcgi_params;
fastcgi_param PATH_INFO $2;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/var/run/php5-fpm.sock;
}
}
当我在 nginx 中激活调试日志时,我可以看到这条奇怪的线:
2014/05/18 14:27:08 [debug] 19676#0: *1 open index "/srv/piwik/index.php"
2014/05/18 14:27:08 [debug] 19676#0: *1 internal redirect: "/piwik/index.php?"
2014/05/18 14:27:08 [debug] 19676#0: *1 rewrite phase: 1
[...]
我的错误在哪里?
谢谢 ;)
【问题讨论】: