先配置好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";
}
}