可以使用nginx的测试命令来验证下nginx.conf的配置是否正确:
nginx -t
查看Nginx是否启动,Linux每运行一个程序就会产生一个进程,那么可以通过查看Nginx进程来判断它是否运行
ps -ef | grep nginx
根据pid来判断Nginx是否启动。
ps -C nginx -o pid
查看80端口运行的程序来判断Nginx是否运行
netstat -anp | grep :80
使用lsof命令来查看80端口是否有程序在运行
lsof -i:80
curl: (7) Failed to connect to ** port 80: No route to host
curl: (7) Failed to connect to ** port 443: No route to host
#通过防火墙,开放端口,
iptables -I INPUT -p tcp --dport 80 -j ACCEPT
iptables -I INPUT -p tcp --dport 443 -j ACCEPT