Linux Notes (65) - nginx agent tomcat
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.

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

To deploy multiple projects through Tomcat, you need to create a webapp directory for each project and then: Automatic deployment: Place the webapp directory in Tomcat's webapps directory. Manual deployment: Manually deploy the project in Tomcat's manager application. Once the project is deployed, it can be accessed by its deployment name, for example: http://localhost:8080/project1.

The Tomcat website root directory is located in Tomcat's webapps subdirectory and is used to store web application files, static resources, and the WEB-INF directory; it can be found by looking for the docBase attribute in the Tomcat configuration file.

Running projects with different port numbers on the Tomcat server requires the following steps: Modify the server.xml file and add a Connector element to define the port number. Add a Context element to define the application associated with the port number. Create a WAR file and deploy it to the corresponding directory (webapps or webapps/ROOT). Restart Tomcat to apply changes.

Converting an HTML file to a URL requires a web server, which involves the following steps: Obtain a web server. Set up a web server. Upload HTML file. Create a domain name. Route the request.

Reasons for Tomcat garbled characters: 1. Character set mismatch; 2. HTTP response header is not set correctly; 3. Filter or encoder configuration error; 4. Web page encoding is incorrect; 5. Other reasons (including server-side language, database encoding and proxy server issues).

Tomcat can run HTML and JSP. The method is as follows: copy the HTML file to the corresponding subdirectory of the Tomcat directory and access it in the browser. Copy the JSP file to the corresponding subdirectory of the Tomcat directory, and use the <%@ page %> directive to specify the Java code and access it in the browser.

To add a server to Eclipse, follow these steps: Create a server runtime environment Configure the server Create a server instance Select the server runtime environment Configure the server instance Start the server deployment project

Steps to deploy a WAR file using Tomcat: Unzip the WAR file into Tomcat's webapps directory. Create a directory with the same name as the WAR file and move the unzipped files to that directory. Start the Tomcat service. The WAR file is automatically deployed at startup and can be accessed through the browser. The URL format is: http://localhost:8080/WAR_file_directory name/
