为子域配置服务器时,NGINX无法工作

发布时间:2020-07-07 06:12

nginx.service的作业失败,因为控制进程退出并显示错误代码。 有关详细信息,请参见“ systemctl status nginx.service”和“ journalctl -xe”。

在出现此提示之前,服务器工作正常,但是当我尝试将服务器配置为子域时,该服务器无法使用此错误。

还提供详细的错误信息...

[ec2-user@ip--------- 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 Tue 2020-07-07 06:03:04 UTC; 4min 17s ago
  Process: 71445 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)
  Process: 71444 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS)
 Main PID: 70298 (code=exited, status=0/SUCCESS)

Jul 07 06:03:04 ip-999.ap-south-1.compute.internal systemd[1]: Starting The nginx HTTP and reverse proxy serv>
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal nginx[71445]: nginx: [emerg] unexpected end of file, expec>
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal nginx[71445]: nginx: configuration file /etc/nginx/nginx.c>
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal systemd[1]: nginx.service: Control process exited, code=ex>
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal systemd[1]: nginx.service: Failed with result 'exit-code'.
Jul 07 06:03:04 ip-999.ap-south-1.compute.internal systemd[1]: Failed to start The nginx HTTP and reverse pro>
lines 1-13/13 (END)
回答1

您有一个错误unexpected end of file,请检查NGINX配置的语法,因为很可能文件已损坏。

可能的候选者忘记关闭}字符。

回答2

您始终可以使用以下命令检查配置错误:

currentUser

在启动灾难性的重启之前:)