Environment construction under Linux
Install and configure nginx
http://www.centoscn.com/image-text/install/2014/0812/3480.html
wget http://nginx.org/download/nginx-1.11.9.tar.gz
Download address: http://nginx.org/download/nginx-1.10.3.tar.gz
View the command after startup:
Command one:
netstat -antp | grep nginx View the program whose program name contains "nginx" in the current computer connection, and it will display the occupied port, occupied process number, and program name.
Command two:
ps aux | grep nginx to see if nginx is a running process, this command cannot display the port number
Resolving inaccessible practices
Method 1: Turn off the firewall
https://zhidao.baidu.com/question/303901938543294164.html
/etc/init.d/iptables stop
Method 2: By opening the specified port
step1: Add the following to /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT #Allow all IPs to access port 80
or
-A INPUT -m state --state NEW -m tcp -p tcp -s 192.168.0.103 --dport 80 -j ACCEPT #Only allow the specified ip: 192.168.0.103 to access port 80
step2:重启iptables, service iptables restart
Note: It is not under the /etc/init.d/iptables file. If you don't know how to open the port, you can refer to the open 22 port to write -s is to specify the source address, -d is to specify the destination address.
nginx start and stop
nginx -h can find all the commands of nginx
nginx -s stop shuts down immediately
nginx -s quit closes after the request is over
nginx -s reload restart
nginx -h can find all the commands of nginx
Official website reference address: http://nginx.org/en/docs/beginners_guide.html
nginx signal
kill -signal nginx process id or kill -HUP `cat /usr/local/nginx/logs/nginx.pid`
Note: ` is a backtick and you can use $() instead of ``
Signal control official website reference address: http://nginx.org/en/docs/control.html
boot
http://www.cnblogs.com/jtlgb/p/5809808.html
The practice of self-starting at boot
Put the nginx file in the /etc/init.d directory
chkconfig --add nginx
chkconfig nginx on
Setting up the environment under Windows
Reference article:
The installation method provided by the official website: http://nginx.org/en/docs/install.html