Debian 12:nginx:[错误] open()“/run/nginx.pid”失败(2:没有这样的文件或目录)

问题描述 投票:0回答:1

我正在尝试将 .net 7 Debian 12 上的 Web Api 上传到远程主机。我用我的 API 创建了一个服务,它说它正在本地主机上运行并运行,但是当我尝试编写时:

 sudo nginx -s  reload

我收到错误

2023/12/09 07:22:50 [notice] 2896#2896: signal process started
2023/12/09 07:22:50 [error] 2896#2896: open() "/run/nginx.pid" failed (2: No such file or directory)

我尝试了以下命令

nginx -c /etc/nginx/nginx.conf

但我仍然遇到错误

nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address already in use)
nginx: [emerg] bind() to [::]:80 failed (98: Address already in use)
nginx: [emerg] still could not bind()

之后我决定关掉apache,因为它可能占用了这个端口

sudo apachectl stop

我也尝试过

sudo service nginx restart

但是我仍然遇到错误

Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xeu nginx.service" for details.

我也尝试过

sudo nginx -s reload -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

我在

nginx.pid
找到了我的
/run/nginx.pid
,其中包含
3309

我不知道该怎么办了,也许你也遇到过这样的问题?

nginx debian webapi .net-7.0
1个回答
0
投票

我仔细研究了每次给我的错误,有很多,因此决定通过命令进入文件

sudo nano /etc/nginx/sites-available/default

我查看了

loacation
里面写的内容,令我惊讶的是,有一个命令无论如何都给出了404错误并且没有上传文件。

© www.soinside.com 2019 - 2024. All rights reserved.