2017-08-07 89 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

目錄結構在根指令中定義。 –