Centos Apache 80 Agent Tomcat 8080 Port

Operating environment: Centos 6.5
Apache: 2.2.5

  1. Open the corresponding module of apache proxy

Edit /etc/httpd/conf/httpd.conf file

sudo vim /etc/httpd/conf/httpd.conf

In the view module, with proxy is there a # at the beginning of the word, if not, it means that the proxy module has been turned on

LoadModule proxy_module modules/mod_proxy. so
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
LoadModule proxy_ftp_module modules/mod_proxy_ftp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
LoadModule proxy_ajp_module modules/module_proxy_ajp.so
proxy_connect_module modules/mod_proxy_connect.so
  1. apache vhost add loading and sending function

ServerName www.tomcat.test< br /> ServerAlias ​​www.tomcat.test tomcat.test
ServerAdmin [email protected]
ProxyPreserveHost On
ProxyRequests Off
ProxyPass / ajp://localhost:8009/

Accessing the domain name should be fine

Because I tried to use httpProxies in the form of

ProxyPass / http://localhost:8080
ProxyPassReverse/ http://localhost:8080

But if the domain name is on the external network, When accessing Apache port 80, Chrome's Console will prompt an error similar to the failure to load http://localhost:8080/test/js/web.js.

References
  1. Apache 80 port reverse proxy tomcat port 8080
  2. Use Apache 80 port to proxy tomcat port 8080 mentioned In the Tomcat official website document, there is content about Proxy.
  3. The port 80 of the Apache second-level domain name is mapped to the port 8080 of Tomcat through the proxy, and then I tried the connection method of ajp
  4. Apache integrated Tomcat ( Firstly, Apache released a PHP project, occupying port 80, and tomcat released a Java project, occupying port 8080) It was specially added because of the words below

Leave a Comment

Your email address will not be published.