First, install and decompress nginx tomcat. There is a lot of information on the Internet. I won’t go into details here.
Here we mainly use nginx to implement proxy configuration for multiple tomcats. First, the configuration file of nginx is conf/ngins.conf;
The description scenario has 8080 Under the Tomcat1 project A. There is 8090 under the 8090 port under TOMCAT2 project B.
...
Access projects under different Tomcat through using a domain name+(different) project name .
Configure files如下:(均在conf文件内添加即可 不删除或修改其他内容).
server {
listen 80; server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
Location /Name1 {
proxy_pass http://localhost:8080/A The host name and port number are replaced by host:8080. Otherwise, a 404 error will be reported when loading js and css files due to domain name issues.
index index.html index.htm;
}
location /Name2 {
#root html;
proxy_pass http://localhost:8090/B;
proxy_redirect http://host:8090 http://$host:$server_port;
index index.html index.htm;
}
...... ....Omit
The above introduces the nginx reverse proxy multiple tomcat configuration to solve the problem that js css cannot be loaded due to the 404 problem, including the content of tomcat configuration. I hope it will be helpful to friends who are interested in PHP tutorials.