: This article mainly introduces the problem of nginx domain name redirection. if you are interested in the PHP Tutorial, please refer to it. At the customer's request, we need to assign a domain name to the customer. then, we recommend that you do not have a domain name server in the background. this is not safe. domain names are generally configured on external web servers;
Install nginx with another blog post, and then modify the configuration file as follows:
Server {
Listen 80; ---------- fixed port 80
Server_name a B; ------ separated by commas (,) between the first-level domain name and second-level domain name
Location /{
Root/alidata1/tomcat-tes /......; -------- Server absolute path root directory
Index index.html index.htm index. jsp;
Proxy_send_timeouts 1200;
Proxy_connect_timeout 1200;
Proxy_pass http: // 121. 41. *. 216 *; ---------- address to be compared
Proxy_set_header X-Real-IP $ remote_addr;
Proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
Proxy_set_header Host $ http_host;
}
Location/share {-------- second-level path of the server business module
Index index.html index.htm index. jsp;
Proxy_send_timeouts 1200;
Proxy_connect_timeout 1200;
Proxy_pass http: // 121.4 *;
Proxy_set_header X-Real-IP $ remote_addr;
Proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
Proxy_set_header Host $ http_host;
}
Location/chao {
Index index.html index.htm index. jsp;
Proxy_send_timeouts 1200;
Proxy_connect_timeout 1200;
Proxy_pass http: // 121.41.4 */;
Proxy_set_header X-Real-IP $ remote_addr;
Proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for;
Proxy_set_header Host $ http_host;
}
}
After modification, restart the nginx command, service nginx restart
Restart tomcat if necessary,
Nginx
The above describes the problems encountered by nginx domain name redirection, including some content, and hope to be helpful to friends who are interested in PHP tutorials.