首页 > 解决方案 > 我在我的 nginx.conf 中添加了一个 HSTS 标头,现在它不会启动

问题描述

我在我的 nginx.conf 中添加了一个 HSTS 标头,现在它不会启动。我删除了它,然后尝试重新启动,没有运气。

systemctl 状态 nginx.service

 nginx.service - A high performance web server and a reverse proxy server
     Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
    Drop-In: /etc/systemd/system/nginx.service.d
             └─limits.conf
     Active: failed (Result: exit-code) since Tue 2021-09-28 14:43:48 UTC; 13min ago
    Process: 65187 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=1/FAILURE)

Sep 28 14:43:48 localhost systemd[1]: Starting A high performance web server and a reverse proxy server...
Sep 28 14:43:48 localhost nginx[65187]: nginx: [warn] "ssl_stapling" ignored, issuer certificate not found for certificate "/var/www/22222/cert/22222.crt"
Sep 28 14:43:48 localhost nginx[65187]: nginx: [emerg] "rewrite" directive is not allowed here in /etc/nginx/nginx.conf:109
Sep 28 14:43:48 localhost nginx[65187]: nginx: configuration file /etc/nginx/nginx.conf test failed
Sep 28 14:43:48 localhost systemd[1]: nginx.service: Control process exited, code=exited, status=1/FAILURE
Sep 28 14:43:48 localhost systemd[1]: nginx.service: Failed with result 'exit-code'.
Sep 28 14:43:48 localhost systemd[1]: Failed to start A high performance web server and a reverse proxy server.

(Ubuntu 20.04)

我没有备份 - 无论如何我可以在不丢失我的 WordPress 网站的情况下解决这个问题吗?

标签: wordpressubuntunginxwebserver

解决方案


推荐阅读