Nginx Proxy_pass导致无法加载资源

时间:2016-04-08 16:13:41

标签: nginx web

我在一台机器上设置了一个Web服务器(ip:192.168.0.100:9000)。如果我直接访问它,我的网页工作正常。但现在,我想通过另一台机器(ip:192.168.0.200:9001)访问它。我在192.168.0.200上设置了一个nginx代理服务器。当我访问http://192.168.0.200:9001/时,网页显示无法找到所有js或css文件。如

Failed to load resource: net::ERR_CONNECTION_REFUSED
http://192.168.0.200:9001/bower_components/angular-ui-select/dist/select.css
Failed to load resource: the server responded with a status of 404 (Not Found)
http://192.168.0.200:9001/bower_components/animate.css/animate.css 
Failed to load resource: the server responded with a status of 404 (Not Found)
.....

如何设置它,允许用户通过代理服务器访问网页?是否可以在nginx中设置它?我在192.168.0.200上的nginx配置文件是:

server {
    listen 9001;

    location / {
      proxy_set_header X-Real-IP $remote_addr;
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
      proxy_set_header Host $http_host;
      proxy_set_header X-NginX-Proxy true;
      proxy_pass http://192.168.0.100:9000/;
      proxy_redirect http://192.168.0.100:9000/ /;
    }

}

0 个答案:

没有答案