A, download

Centos7 is used only

    yum install -y nginx
Copy the code

Second, the use of

Nginx is installed in /etc/nginx

    nginx: [error] open() "/run/nginx.pid" failed (2: No such file or directory)
Copy the code

Solution: Find your nginx.conf folder and run a command like the following

Four, agents,

Acting capture

nginx -c etc/nginx/nginx.conf  
Copy the code

Run again

    nginx -s reload
Copy the code

Listen is the specific proxy port. Server_name is the local access port. In this case, how the project is started determines the proxy port

http://192.168.8.88/api/
sj.com/api

Of course, the proxy can also be configured as follows:

Nginx common commands

nginx -s stop Shutting down Nginx quickly, possibly without saving the information, and quickly terminating the Web service.
nginx -s quit Shut down Nginx smoothly, save the information, and end the Web service on schedule.
nginx -s reload Reloading because nginx-related configurations have changed and need to be reloaded.
nginx -s reopen Re-open the log file.
nginx -c filename Specify a configuration file for Nginx instead of the default.
nginx -t Does not run, but only tests the configuration file. nginx
nginx -v Displays the version of nginx.
nginx -V Displays nginx version, compiler version, and configuration parameters.