Preface:

Nginx (Nginx Chinese document) is a high-performance HTTP and reverse proxy server, as well as an IMAP/POP3/SMTP proxy server.

I won’t go into Nginx introduction, installation, and some simple commands here. Leave a link to Nginx introduction, installation, and common commands.

Body:

After dabbling with Nginx, you want to deploy other projects ahead of the successful deployment of the original first project.

This is the first item configured for port 88

1. Deploy multiple projects on the same port without changing the configuration

At first I thought it was easy and didn’t need to change the configuration. I went to my first deployment directory, /usr/share/nginx/html, and put the packed dist in the HTML folder

2. Modify the configuration and deploy different projects for different ports

3. Modify the configuration to deploy multiple projects on the same port

Location mapping to allow multiple projects to be deployed on the same port. The following figure shows the configuration information

listen 3333 default_server; listen [::]:3333 default_server; server_name localhost; root /usr/share/nginx/test/; location /test1 { alias /usr/share/nginx/test/test1; index index.html; } location /test2 { alias /usr/share/nginx/test/test2; index index.html; }}Copy the code

I created a new service using port 3333 (your server security group needs to open this port)

Reload the configuration and restart the servicehttp://url:3333/test1/ 和 http://url:3333/test2/


summary

Nginx is a lightweight, high-performance, stable, and concurrent HTTP and reverse proxy server. I’m just experimenting with some simple features. Write this article for your future self to read

Try it yourself! Try it yourself! Try it yourself! Just try it a few more times