Home >Backend Development >PHP Tutorial >Linux Notes (65) - nginx agent tomcat

Linux Notes (65) - nginx agent tomcat

WBOY
WBOYOriginal
2016-07-29 08:57:381062browse

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>
').addClass('pre-numbering').hide(); $(this).addClass('has-numbering').parent().append($numbering); for (i = 1; i ').text(i)); }; $numbering.fadeIn(1700); }); });

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.

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