nginx: [error] invalid PID number in /var/run/nginx.pid

[[email protected] conf.d]# nginx -s reopen
nginx: [warn] conflicting server name "localhost" on 0.0.0.0:80, ignored
nginx: [error] invalid PID number "" in "/var/run/nginx.pid"

Set the loaded configuration file to:

[[email protected] conf.d]# nginx -c /etc/nginx/nginx.conf
[[email protected] conf.d]# nginx -s reload
[[email protected] conf.d]# nginx -v
nginx version: nginx/1.18.0
[[email protected] conf.d]# nginx -s reopen
[[email protected] conf.d]#

Read More: