First configuration: Nginx
# cd/etc/nginx/conf.d/ # CP default.conf tomcat.conf Nano tomcat.conf
Please enter in the tomcat.conf:
server { listen ; server_name mydomain.com; Index index.jsp; Root /usr/share/nginx/html/h5; / { proxy_pass http://mydomain.com:8080; $http _host ; Proxy_set_header X$remote _addr; Proxy_set_header X-forwarded-for$proxy _add_x_forwarded_for; }
Please note here: mydomain.com is your domain name,/USR/SHARE/NGINX/HTML/H5 is your project path, which corresponds to the following Tomcat.
Second, modify the Server.xml
# Nano/usr/local/tomcat/conf/server.xml
Please modify the following:
"mydomain.com"Appbase="/usr/share/nginx/html/h5"unpackwars="true"autodeploy="true"><context Path=""Docbase="/usr/share/nginx/html/h5"debug="0"reloadable="false"crosscontext="tr$ <valve classname="Org.apache.catalina.valves.AccessLogValve"directory="Logs"prefix="Localhost_access_log."suffix=". txt"pattern="%h%l%u%t "%r" %s%b"/> </Host>
CentOS7 Nginx+tomcat implements proxy access to Java Web projects enabling projects to support JSP and PHP