鍍金池/ 問答/Linux  HTML/ nginx 反代理端口報錯

nginx 反代理端口報錯

添加

[root@localhost conf.d]# vi corenet.conf
server
{
listen 80;
server_name www.liangzda.com;
location /{
proxy_pass http://localhost:5000;
}
}
執(zhí)行

[root@localhost conf.d]# nginx -s reload
[root@localhost conf.d]# systemctl restart nginx
Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx .service" and "journalctl -xe" for details.

詳細(xì)錯誤如下
[root@localhost conf.d]# systemctl status nginx.service
● nginx.service - The nginx HTTP and reverse proxy server
Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled)
Active: failed (Result: exit-code) since 二 2018-04-10 20:31:27 CST; 43s ago
Process: 2816 ExecStart=/usr/sbin/nginx (code=exited, status=1/FAILURE)
Process: 2813 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS)
Process: 2811 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)

4月 10 20:31:25 localhost.localdomain nginx[2816]: nginx: [emerg] bind() to [::]:80 failed (98: Address al...use)
4月 10 20:31:26 localhost.localdomain nginx[2816]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address...use)
4月 10 20:31:26 localhost.localdomain nginx[2816]: nginx: [emerg] bind() to [::]:80 failed (98: Address al...use)
4月 10 20:31:26 localhost.localdomain nginx[2816]: nginx: [emerg] bind() to 0.0.0.0:80 failed (98: Address...use)
4月 10 20:31:26 localhost.localdomain nginx[2816]: nginx: [emerg] bind() to [::]:80 failed (98: Address al...use)
4月 10 20:31:27 localhost.localdomain nginx[2816]: nginx: [emerg] still could not bind()
4月 10 20:31:27 localhost.localdomain systemd[1]: nginx.service: control process exited, code=exited status=1
4月 10 20:31:27 localhost.localdomain systemd[1]: Failed to start The nginx HTTP and reverse proxy server.
4月 10 20:31:27 localhost.localdomain systemd[1]: Unit nginx.service entered failed state.
4月 10 20:31:27 localhost.localdomain systemd[1]: nginx.service failed.
Hint: Some lines were ellipsized, use -l to show in full.

回答
編輯回答
情殺

端口被占用,應(yīng)該是你已經(jīng)啟了 nginx,或者有其他程序占用了 80 端口

你可以用 ss -lntp | egrep ':80\s' 來看看到底是什么程序在占用 80 端口

2018年1月11日 07:54