1. First confirm whether there are multiple nginx configuration files and whether the configuration is correct.
nginx -t
You can see that my feedback here is that the configuration file of /etc/nginx/nginx.conf is configured normally.
If the configuration file path that appears here does not match your configuration, close the nginx service and start it by specifying the configuration file path.
#关闭nginx
nginx -s stop
#使用指定的配置文件启动nginx
nginx -c ${
你的配置文件路径}
#例如
#nginx -c /etc/nginx/nginx.conf
2. If the above check is correct, confirm whether nginx contains the default configuration file.
You can try to comment out the above two lines of configuration.
Then nginx -s reload
restart the service and try again.