可以使用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:80curl: (7) Failed to connect to ** port 80: No route to hostcurl: (7) Failed to connect to ** port 443: No route to host#通过防火墙,开放端口,iptables -I INPUT -p tcp --dport 80 -j ACCEPTiptables -I INPUT -p tcp --dport 443 -j ACCEPT