1. Go to the conf file and create the subconf management folder conf.d

mkdir conf.d

Go to the conf.d directory to create the required conf file

Example: touch api.conf

Edit the file vim api.conf

server { listen 8001; server_name localhost; location / { root /usr/local/nginx/html; index index.html index.htm; }}Copy the code

2. Go to the nginx.conf file and import the conf.d conf management folder

Introduced in the HTTP

http{ ... include conf/conf.d/*.conf; # *.conf All configuration files}Copy the code

Introduction completed ~

Note: Add the last, most important server security group!