2017-08-07 93 views
1
server { 
listen  80; 
access_log /var/log/nginx/dashboards.access.log; 
error_log /var/log/nginx/dashboards-reg.error.log; 
root /usr/share/nginx/htmlresource; 


     location /performance-platform/landlord-reg { 
        proxy_set_header HOST $host; 
        proxy_set_header X-Forwarded-Proto $scheme; 
        proxy_set_header X-Real-IP $remote_addr; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_pass http://landlord-reg/dashboard/landlord-reg/pages/; 
        proxy_redirect http://landlord-reg/dashboard/landlord-reg/pages/ $scheme://; 
    } 
     location ~* \.(jpg|ttf|jpeg|svg|png|gif|ico|css|js|eot|woff|woff2)$ { 
        root /usr/share/nginx/html/dashboards/landlord-reg/pages; 
        proxy_pass http://landlord-reg; 


     } 

     location /performance-platform/discharges { 
        root /usr/share/nginx/html/dashboards/discharges/pages; 
        proxy_set_header HOST $host; 
        proxy_set_header X-Forwarded-Proto $scheme; 
        proxy_set_header X-Real-IP $remote_addr; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_pass http://discharges/dashboard/discharges/pages/; 
        proxy_redirect http://discharges/dashboard/discharges/pages/ $scheme://; 
      } 
      location ~* \.(jpg|jpeg|svg|png|gif|ico|css|js|eot|woff|woff2)$ { 
        root /usr/share/nginx/html/dashboards/discharges/pages; 
        try_files /usr/share/nginx/html/dashboard/discharges/pages $uri; 
        proxy_pass http://discharges; 

      }      

} 

以上是或多或少都是在站点可用的完整nginx配置。上游服务器是码头集装箱,但这应该没有什么区别。nginx找不到一些JS文件

这找到所有,但我的js文件中的2。

<script src="../resource/feedconf.js"></script> 

这是不是发现^^^

这里,因为这是

<script src="../../../assets/js/widgets/errorWidget.js"></script> 

我已经试过2种不同的方法才达到同样的事情,一个是房东,一个用于排放但也工作。出于想法,因此这里的问题。

+0

请分享文件夹层次结构。 – sam23

回答

0

在我明白的代码初步看来,也许你打算做以下事情。如果你共享你的文件夹层次结构会更好。

server { 
    listen  80; 
    access_log /var/log/nginx/dashboards.access.log; 
    error_log /var/log/nginx/dashboards-reg.error.log; 
    root /usr/share/nginx/htmlresource; 


     location /performance-platform/landlord-reg { 
        proxy_set_header HOST $host; 
        proxy_set_header X-Forwarded-Proto $scheme; 
        proxy_set_header X-Real-IP $remote_addr; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_pass http://landlord-reg/dashboard/landlord-reg/pages/; 
        proxy_redirect http://landlord-reg/dashboard/landlord-reg/pages/ $scheme://; 

    } <-- delete this from here 

     location ~* \.(jpg|ttf|jpeg|svg|png|gif|ico|css|js|eot|woff|woff2)$ { 
        root /usr/share/nginx/html/dashboards/landlord-reg/pages; 
        proxy_pass http://landlord-reg; 


     } 

} <- add this here 

     location /performance-platform/discharges { 
        root /usr/share/nginx/html/dashboards/discharges/pages; 
        proxy_set_header HOST $host; 
        proxy_set_header X-Forwarded-Proto $scheme; 
        proxy_set_header X-Real-IP $remote_addr; 
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
        proxy_pass http://discharges/dashboard/discharges/pages/; 
        proxy_redirect http://discharges/dashboard/discharges/pages/ $scheme://; 

      } <-- delete this from here 

      location ~* \.(jpg|jpeg|svg|png|gif|ico|css|js|eot|woff|woff2)$ { 
        root /usr/share/nginx/html/dashboards/discharges/pages; 
        try_files /usr/share/nginx/html/dashboard/discharges/pages $uri; 
        proxy_pass http://discharges; 
} <- add this here 
      } 
+0

目录结构在根指令中定义。 –