nginx转发tomcat详细
发布网友
发布时间:2022-04-19 15:23
我来回答
共2个回答
热心网友
时间:2022-05-18 08:48
nginx+tomcat 有名的配置简单..
我给你贴下我现在一个项目的配置 你自己参考下吧
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 75;
#gzip on;
upstream www.vwlms.com {
server localhost:8080;
}
server {
listen 80;
server_name www.vwlms.com;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
root html;
index index.html index.htm;
proxy_pass http://www.vwlms.com;
proxy_set_header X-Real-IP $remote_addr;
proxy_connect_timeout 1800s;
proxy_read_timeout 1800s;
proxy_send_timeout 1800s;
client_max_body_size 0;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}
热心网友
时间:2022-05-18 08:49
用 upstream 是可以的。