I have my nginx home at /opt/nginx, inside there are site1 and mail folders, site1 has html folder that is a wordpress installation and mail is a webmail site, both of them must be proxied to php-fpm, site1/html works like a charm no problem at all.
I have the domain1.com and my server delivers site1/html content when domain1.com is requested.
What I want to do is, when domain1.com/mail is requested, serve the content of mail folder (sibling of site1). If I left a index.html file inside mail, when domail1.com/mail is requested, index.html is served to the client without problem but if I try to deliver mail/index.php, 404 error rise instead, what am I doing wrong? below my config:
/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;
}
}