【Nginx】检查配置文件是否正确

时间:2025-04-02 20:22:43

1.进入配置nginx路径

/usr/local/sbin/nginx -t -c /usr/local/nginx/conf/

2.返回这个就是正确

nginx: the configuration file /usr/local/nginx/conf/ syntax is ok
nginx: configuration file /usr/local/nginx/conf/ test is successful

3.可以重启

systemctl restart nginx

其他两种启动方式:

service nginx restart

/usr/sbin/nginx -s reload