Home>Article>Operation and Maintenance> Perform multiple Tomcat forwarding when configuring multiple domain names on Windows Nginx

Perform multiple Tomcat forwarding when configuring multiple domain names on Windows Nginx

坏嘻嘻
坏嘻嘻 Original
2018-09-17 11:09:17 3154browse

The content of this article is about how to configure multiple domain names and multiple Tomcat forwarding in Windows Nginx. It has certain reference value. Friends in need can refer to it. I hope it will be helpful to you.

Nginx download:

Nginx download address

Select the Windows version to download, unzip it directly, and double-click to run.

Open the nginx.conf file in the decompressed conf folder and edit it as follows:

#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 65; #gzip on; upstream www.yfscms.com { server 127.0.0.1:8080; } upstream www.yfscms.net { server 127.0.0.1:9999; } upstream www.yfscms.cn { server 127.0.0.1:8888; } upstream weixin.yfscms.com { server 127.0.0.1:8080; } upstream www.gyhkyl.com { server 127.0.0.1:8899; } upstream 120.26.234.50 { server 127.0.0.1:8899; } upstream demo.zcgl.yfscms.com { server 127.0.0.1:7777; } server { listen 80; server_name www.yfscms.com; location / { index index.html index.jsp; proxy_pass http://www.yfscms.com; proxy_set_header X-Real-IP $remote_addr; client_max_body_size 100m; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 80; server_name www.yfscms.net; location / { index index.html index.jsp; proxy_pass http://www.yfscms.net; proxy_set_header X-Real-IP $remote_addr; client_max_body_size 100m; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 80; server_name www.yfscms.cn; location / { index index.html index.jsp; proxy_pass http://www.yfscms.cn; proxy_set_header X-Real-IP $remote_addr; client_max_body_size 100m; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 80; server_name weixin.yfscms.com; location / { index index.html index.jsp; proxy_pass http://weixin.yfscms.com; proxy_set_header X-Real-IP $remote_addr; client_max_body_size 100m; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 80; server_name www.gyhkyl.com; location / { index index.html index.jsp; proxy_pass http://www.gyhkyl.com; proxy_set_header X-Real-IP $remote_addr; client_max_body_size 100m; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 80; server_name 120.26.234.50; location / { index index.html index.jsp; proxy_pass http://120.26.234.50; proxy_set_header X-Real-IP $remote_addr; client_max_body_size 100m; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } server { listen 80; server_name demo.zcgl.yfscms.com; location / { index index.html index.jsp; proxy_pass http://demo.zcgl.yfscms.com; proxy_set_header X-Real-IP $remote_addr; client_max_body_size 100m; } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }

Rule description:

1. One upstream corresponds to one server

2. "server_name" and "proxy_pass" in the server correspond to upstream

The above is the detailed content of Perform multiple Tomcat forwarding when configuring multiple domain names on Windows Nginx. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn