【发布时间】:2016-02-21 00:40:36
【问题描述】:
我的 nginx 家在 /opt/nginx,里面有 site1 和 mail 文件夹,site1 有 html 文件夹是 wordpress 安装和 mail 是一个 webmail 站点,它们都必须代理到 php-fpm, site1/html 完全没有问题。
我有 domain1.com,当请求 domain1.com 时,我的服务器会提供 site1/html 内容。
我想要做的是,当 domain1.com/mail 被请求时,提供 mail 文件夹的内容(site1)。如果我在邮件中留下 index.html 文件,当请求 domail1.com/mail 时,index.html 毫无问题地提供给客户端,但如果我尝试发送 mail/index.php,404 错误反而上升,我在做什么错误的?在我的配置下方:
/etc/nginx/conf.d/domain1.com.conf
server {
.
.
.
root /opt/nginx/site1/html;
index index.html index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location /mail {
root /opt/nginx/;
try_files $uri $uri/mail mail/index.php;
}
location ~ [^/]\.php(/|$) {
# SECURITY : Zero day Exploit Protection
try_files $uri =404;
fastcgi_split_path_info ^(.+?\.php)(/.*)$;
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
【问题讨论】:
-
我已经尝试过这个link