Nginx load balancing, reverse proxy, and then from the firewall to do forwarding, error, with the external network ip+ port access, the results of CSS style and port are lost!!!!! Intranet ip+ port access, normal!
Solution: Use Chrome's Network tab to analyze the project's path and port! Kill the useless in the config file!
Pro-Test and change the configuration file, note the information!!!!
vi conf/nginx.confworker_processes auto;worker_rlimit_nofile 10000;events { worker_connections 2048; multi_accept on; use epoll;} http {# include mime.types; Note the purpose of the change is, after forwarding, CSS styles can be loaded!!!!!!!!!!! default_type application/octet-stream; upstream test.com { ip_hash; server 192.1.1.100:8080; server 192.1.1.200:8080; } server { listen 8888; #这里与防火墙外网端口一致, otherwise the following $server_port will be out of portDifferent, resulting style cannot load!!!! Another reason is that both inside and outside the network can access!! server_name test.com; location / { proxy_pass http:/ /test.com; proxy_set_header host $host: $server _port; #这里 $server _port is the port to tune listen! The line means to get the original IP and port proxy_set_header x-real-ip $ after forwarding remote_addr; #这里表示把原始的信息带入进来 proxy_set_header X-Forwarded-For $proxy _add_x_forwarded_for; #实际要访问的域名地址, to correspond with the actual access domain name proxy_set_ header x-nginx-proxy true; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } }}
This article from "Mysky" blog, reproduced please contact the author!
Nginx Load Balancer, reverse proxy, and then from the firewall to do forwarding, CSS style and port is missing!