嗨,每次我启动 nginx 时都会出现错误
- Defined-By: systemd
- Support: http://www.ubuntu.com/support
-
- Unit nginx.service has begun starting up.
Dec 21 17:23:50 ferhat-MS-7996 nginx [23904]: nginx: [emerg] unexpected "}" in /etc/nginx/nginx.conf:63
Search 21 17:23:50 ferhat-MS-7996 nginx [23904]: nginx: configuration file /etc/nginx/nginx.conf test failed
Search 21 17:23:50 ferhat-MS-7996 systemd [1]: nginx.service: Control process exited, code = exited status = 1
Search 21 17:23:50 ferhat-MS-7996 systemd [1]: nginx.service: Failed with result 'exit-code'.
Dec 21 17:23:50 ferhat-MS-7996 systemd [1]: Failed to start
- Subject: Unit nginx.service has failed
- Defined-By: systemd
- Support: http://www.ubuntu.com/support
-
- Unit nginx.service has failed.
-
- The result is RESULT.
Search 21 17:23:50 ferhat-MS-7996 sudo [23892]: pam_unix (sudo: session): session closed for user root
答案1
你的配置被破坏了。
Dec 21 17:23:50 ferhat-MS-7996 nginx [23904]: nginx: [emerg] unexpected "}" in /etc/nginx/nginx.conf:63
这是实际错误 - 您的配置中某处有一个意外的右花括号。您需要先修复该问题,然后 NGINX 才能完全启动。
如果没有您的所有配置,我无法帮助您解决问题,因此您必须自己去寻找以确保所有花括号都彼此正确平衡。