CentOS7 Nginx+tomcat implements proxy access to Java Web projects enabling projects to support JSP and PHP

Source: Internet
Author: User
Tags java web

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 &quot;%r&quot; %s%b"/> </Host>

CentOS7 Nginx+tomcat implements proxy access to Java Web projects enabling projects to support JSP and PHP

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.