nginx+tomcat結合

先配置好tomcat, 監聽端口爲8080

配置nginx.conf 修改爲

server {

     listen 80;

    server_name mydomain.com;

    access_log /var/log/nginx/localhost.access.log;

    location /

    {

       #root /var/www/nginx-default;

       #index index.html index.htm;

       proxy_pass http://127.0.0.1:8080/myapp/;  #tomcat的地址

    }

    error_page 500 502 503 504 /50x.html;

    location = /50x.html {

      root /var/www/nginx-default;

    }

    #配置監控

    location /status {
                 stub_status             on;
                access_log              /usr/local/nginx/logs/status.log;
                auth_basic              "NginxStatus"; 
 
      }

}

發佈了43 篇原創文章 · 獲贊 1 · 訪問量 20萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章