Compile and install nginx
Note: When compiling and installing nginx, there should be a dedicated startup user, we set this user to www
Create a dedicated startup user www
- useradd www -s /sbin/nologin -M
- ./configure --prefix=/data1/server/nginx --user=www --group=www
Nginx startup test:
- /data1/server/nginx/sbin/nginx
- netstat -tnulp | grep nginx
Nginx configuration
Server explained:
Nginx simple operation practice
Introduction to nginx commands
Check nginx
- /data1/server/nginx/sbin/nginx -t
Start nginx
- /data1/server/nginx/sbin/nginx
Close nginx
- /data1/server/nginx/sbin/nginx -s stop
Overload nginx
- /data1/server/nginx/sbin/nginx -s reload
Note: overloading is similar to closing nginx and starting nginx
Check after startup
- netstat -tnulp | grep nginx