Home  >  Article  >  Backend Development  >  nginx reverse proxy multiple tomcat configuration solves the problem that js css cannot be loaded due to 404 problem myeclipse tomcat configuration tomcat download eclipse configuration tomcat

nginx reverse proxy multiple tomcat configuration solves the problem that js css cannot be loaded due to 404 problem myeclipse tomcat configuration tomcat download eclipse configuration tomcat

WBOY
WBOYOriginal
2016-07-29 08:50:014187browse

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 {

html;

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

}

Save the configuration and restart. Let’s complain about the restart of nginx. It’s very troublesome. I stopped it directly in the task manager and then restarted it.

The above can achieve localhost+A--- ----访问tomcat A项目

                         localhost+B-------访问tomcat B项目

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.

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