Nginx Load Balancer, reverse proxy, and then from the firewall to do forwarding, CSS style and port is missing!

Source: Internet
Author: User
Tags nginx load balancing

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!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.