systemctl status nginx
输出示例: - 绿色"active (running)"表示正常运行 - "inactive (dead)"表示未运行 - 红色"failed"表示启动失败
service nginx status
ps aux | grep nginx
应该能看到master和worker进程
netstat -tulnp | grep nginx
# 或
ss -tulnp | grep nginx
正常情况应显示80和/或443端口监听
nginx -t
输出"configuration file /etc/nginx/nginx.conf test is successful"表示配置正确
tail -f /var/log/nginx/error.log
curl -I http://localhost
应返回HTTP 200或301/302响应
如果配置了stub_status模块,可以访问:
curl http://localhost/nginx_status
nginx -t
的输出,修正配置错误netstat -tulnp
检查80/443端口是否被其他程序占用需要更具体的帮助时,请提供相关错误信息或日志内容。