Root directory is lost when proxy_pass / to another machine

Hello,

I have two server, 10.1.1.1, 10.1.1.2.

10.1.1.1 have following nginx.conf, it forword “/” to 10.1.1.2, and it
also has “/upload.php” page.

location / {
root html;
proxy_pass http://10.1.1.2;
}

location /upload.php {
root html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME
/opt/nginx/html/$fastcgi_script_name;
include fastcgi_params;
}

My problem is
In upload.php page, it has

However, the css is not working for http://10.1.1.1/upload.php

If I comment out proxy_pass http://10.1.1.2;
then css is working fine for upload.php page.

Could anyone help me to solve the issue?
Thank you.

The problem is solved :slight_smile:

Add this into nginx.conf in 10.1.1.1

location /css {
root html;
}