On the internet to see an example, if the network configuration, but if the page contains a local picture (if the URL to refer to the image will not be a problem), will cause the page can not be displayed normally.
The following is an example based on the red part of the modification:
Suppose there are multiple addresses in the intranet, such as:
Http://192.168.10.1/manage
Http://192.168.10.2/manage2
There is an external public network address 100.100.112.121, want to implement the request:
Visit 100.100.112.121/bbsadmin to access Http://192.168.10.1/manage
Visit 100.100.112.121/cmsadmin to access Http://192.168.10.1/manage2
The configuration is as follows:
server {
Listen 5000;
server_name 127.0.0.1;
CharSet Utf-8;
Location/{
root HTML;
Index index.html index.htm;
}
Error_page 404/404.html;
# REDIRECT Server error pages to the static page/50x.html
Error_page 502 503 504/50x.html;
Location =/50x.html {
root HTML;
}
Description: If the Site page contains a local picture, through Nginx may appear, this time need in the Server configuration section (Note that the current settings Agent server.) Make a mistake today, write this configuration section in the Server Configuration section of Nginx's own port) setting:
location ~* \. (css|js|jpg|bng|html|css|png|gif|ico|) $ {
Root D:/nodejs/nodejs project; #静态文件保存目录的上一级父目录
Expires 24h; #设置过期时间
}
Location/bbsadmin {
Proxy_pass Http://192.168.10.1/manage;
Proxy_redirect off;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header Host $http _host;
}
location/cmsadmin{
Proxy_pass Http://192.168.10.1/manage2;
Proxy_redirect off;
Proxy_set_header x-forwarded-for $proxy _add_x_forwarded_for;
Proxy_set_header X-real-ip $remote _addr;
Proxy_set_header Host $http _host;
}
}
Root Path
In server: Represents the global, meaning for all of the location.
In Location: local resource definition
location/a/{
root/var/www/;
}
Location/On behalf of the root in the location, if the root in location is not defined, it inherits from the server.