nginx is a reverse proxy server, it can proxy php, and it can also proxy tomcat
First of all, you need to install nginx, jdk, tomcat
The installation of tomcat is very simple, just unzip it and run it.
Then enter the directory where the ngxin configuration file is located. Mine is in /usr/local/nginx/conf
Create a configuration file. Try to avoid modifying the original configuration file. Just use the configuration file we created when opening it
<code>vim jsp<span>.conf</span></code>
The content is as follows:
<code>user nobody; worker_processes <span>4</span>; events{ worker_connections <span>1024</span>; } http{ <span>server</span> { listen <span>80</span>; server_name localhost; location ~ \.jsp$ { root /usr/local/tomcat/webapps; <span>index</span><span>index</span>.jsp; proxy_pass http:<span>//localhost:8080;</span> } } }</code>
The above configuration indicates that port 80 is monitored, and all addresses ending with .jsp are forwarded to localhost:8080, which is tomcat. The project directory is deployed under /usr/local/tomcat/webapps
Then start tomcat
<code><span>cd</span> /usr/local/tomcat/bin ./startup.sh</code>
Start ngxin and use the configuration file we just created
<code>/usr/<span>local</span>/nginx/sbin/nginx <span>-c</span> /usr/<span>local</span>/nginx/conf/jsp<span>.</span>conf</code>
The above introduces Linux Notes (65) - nginx agent tomcat, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.