I have a Wordpress instance running on first nginx server ( Virtual Machine A ) . I can work with perfectly fine locally, everythings is well resolved and all path are accessed ( like /wp-admin/ , /wp-content/ , /wp-includes/ etc... ) thru my url www.corph.mouradcloud.com
As for now, I am not using SSL, so this a later issue :)
here is the config of my Nginx web instance :
upstream php-wp {
server unix:/var/run/mouradcloud.sock;
}
server {
listen 80;
listen [::]:80;
server_name www.corph.mouradcloud.com;
root /var/www/mouradcloud;
index index.php;
location / {
try_files $uri $uri/ /index.php?$args;
}
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location ~ .php$ {
include fastcgi.conf;
fastcgi_pass php-wp;
}
location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
expires max;
log_not_found off;
}
}
I have a second Nginx server that I use as a Proxy with a different URL ( Virtual Machine B ) . After a little of google, I noticed that some other parameters need to be added to have the PHP scripts thru proxy either.
here is the proxy nginx file :
server {
listen 80;
listen [::]:80;
server_name www.mouradcloud.com;
location / {
proxy_pass http://www.corph.mouradcloud.com;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-For $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
}
Strangely, when a client is connecting using the web browser dbugger the path /wp-content/ , /wp-includes/ are resolved thru :
www.corph.mouradcloud.com
instead of
www.mouradcloud.com
here is the screenshot of the debugger, we can see that only documents are passing thru the proxy, scripts are rejected while it should not since I am passing every thing thru the proxy in the request..
My guess is there is some parameters that I am missing.
I tryed to add other location like /wp-includes/ , but I ended up screwing everything ...
I reviewed all the SO thread but noone has an answers so far