2016-11-28 40 views
0

我在野蠻10.1應用程序服務器上部署了webapp。 這個Web應用程序是傾聽:http://localhost:8080/app-profile-jsp/(1)將nginx配置爲野蠻web應用程序的反向代理

我成功安裝了nginx。服務器已成功安裝,我測試以提供靜態網頁和圖像。

現在我想配置nginx以訪問 「http://www.frizio.local」(2)url的web應用程序。 我在/ etc/hosts中配置了這個地址。

我在nginx中的配置如下: server { listen 80; server_name frizio.local www.frizio.local;

access_log  /var/log/nginx/static.access.log; 
    error_log  /var/log/nginx/static.error.log; 

    root /srv/http/static; 


    location/{ 
      proxy_pass http://localhost:8080/app-profile-jsp; 
      proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504; 
      proxy_redirect off; 

      proxy_set_header Host   $host; 
      proxy_set_header X-Real-IP  $remote_addr; 
      proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; 
      proxy_set_header X-Forwarded-Proto https; 

    } 


    location /pics { 
      autoindex on; 
      autoindex_exact_size off; 
    } 

} 當我嘗試進入(2)服務器響應 「404未找到」。

幫助幫助!!!! 在此先感謝

回答

0

我想你錯過了的ProxyPass的後/:

proxy_pass http://localhost:8080/app-profile-jsp/; 

的其他事情,我不認爲你需要在這裏proxy_redirect off;

希望它有幫助!

+0

非常感謝!另一個新手問題:我認爲重定向存在問題,無法管理我的野蠻web應用包含的頁面。我有一個錯誤「無效參數:redirect_uri」..我想我會在配置文件中的某些行添加$ request_uri。不是嗎?哪裏? – frizio

+0

您是否試過這樣做: 'location/{proxy_pass http:// localhost:8080/app-profile-jsp /; }' 沒有重定向,上游...只是proxy_pass。 – ZHAJOR