I want to create a vhost for a php website in this folder:
/var/www/mydomain.com/home
and an alias for this folder for a wordpress blog:
/var/www/mydomain.com/public_html
I try this vhost:
server {
listen 80;
root /var/www/mydomain.com/home;
index index.php index.html index.htm;
charset UTF-8;
server_name mydomain.com;
access_log /var/log/nginx/mydomain.com.access.log;
error_log /var/log/nginx/mydomain.com.error.log debug;
location /blog {
alias /var/www/mydomain.com/public_html;
try_files $uri $uri/ /index.php?$args =404;
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
With this configuration, my website work fine, the homepage of my blog is OK, static files are OK, the page like http://mydomain.com/blog/wp-login.php are OK, all the admin panel is OK :
http://mydomain.com/blog/wp-admin/
(wp-admin folder exist)
But the page in front of like
http://mydomain.com/blog/terms-and-conditions/
http://mydomain.com/blog/contact/
or all the page with / like blog/…/… always go to my /var/www/mydomain.com/home/index.php
What did I forget to do?