gpt4 book ai didi

ssl - Nginx , LetsEncrypt - [emerg] "ssl_certificate"指令不允许在/etc/nginx/sites-enabled/example.com.conf :33 nginx:

转载 作者:太空宇宙 更新时间:2023-11-03 13:33:58 24 4
gpt4 key购买 nike

我正在尝试使用 lets encrypt 为我的网站生成 ssl 证书,但出现以下错误:

[emerg]/etc/nginx/sites-enabled/example.com.conf:33 nginx: 配置文件/etc/nginx/nginx.conf 中不允许使用“ssl_certificate”指令

我正在使用 Virtualmin 和 Nginx

非常感谢任何帮助

-------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ---------------------------------------------- ----------


网站.com.conf

server {

server_name example.com www.example.com;
listen 10.0.1.4;
root /home/example/public_html/public;
index index.html index.php;
access_log /var/log/virtualmin/example.com_access_log;
error_log /var/log/virtualmin/example.com_error_log;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME /home/example/public_html/public$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT /home/example/public_html/public;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_param HTTPS $https;

location /
{
try_files $uri $uri/ /index.php?$query_string;
gzip on;
}

location ~* \.(?:css|js|woff|eot|svg|ttf|otf|png|gif|jpe?g)
{
expires max;
}

location ~ \.php$
{
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}

location ~ /\.ht
{
deny all;
}

location ^~ /.well-known/acme-challenge/ {

alias /home/example/public_html/;
}

listen 10.0.1.4:443 default_server ssl;
ssl_certificate /home/example/ssl.cert;
ssl_certificate_key /home/example/ssl.key;
}

Nginx session :

user www-data;
worker_processes auto;
pid /run/nginx.pid;

events {
worker_connections 768;
# multi_accept on;
}

http {

##
# Basic Settings
##

sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
# server_tokens off;

# server_names_hash_bucket_size 64;
# server_name_in_redirect off;

include /etc/nginx/mime.types;
default_type application/octet-stream;

##
# SSL Settings
##

ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;

##
# Logging Settings
##

access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log;

##
# Gzip Settings
##

gzip on;
gzip_disable "msie6";

gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_buffers 16 8k;
gzip_http_version 1.1;
gzip_types text/plain application/x-font-ttf text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript;

##
# Virtual Host Configs
##

include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
server_names_hash_bucket_size 128;
}


#mail {
# # See sample authentication script at:
# # http://wiki.nginx.org/ImapAuthenticateWithApachePhpScript
#
# # auth_http localhost/auth.php;
# # pop3_capabilities "TOP" "USER";
# # imap_capabilities "IMAP4rev1" "UIDPLUS";
#
# server {
# listen localhost:110;
# protocol pop3;
# proxy on;
# }
#
# server {
# listen localhost:143;
# protocol imap;
# proxy on;
# }
#}

grep -rHn "ssl_certificate"/etc/nginx 结果

/etc/nginx/snippets/snakeoil.conf:4:ssl_certificate /etc/ssl/certs/ssl-cert-snakeoil.pem;
/etc/nginx/snippets/snakeoil.conf:5:ssl_certificate_key /etc/ssl/private/ssl-cert-snakeoil.key;
/etc/nginx/sites-available/example.com.conf.save:31: ssl_certificate /home/example/ssl.cert;
/etc/nginx/sites-available/example.com.conf.save:32: ssl_certificate_key /hom/example/ssl.key;
/etc/nginx/sites-available/example.com.conf:57: ssl_certificate /home/example/ssl.cert;
/etc/nginx/sites-available/example.com.conf:58: ssl_certificate_key /home/example/ssl.key;

最佳答案

您的问题是您在创建备份 .save 文件的编辑器中编辑了一个文件

所以删除文件

rm /etc/nginx/sites-available/example.com.conf.save

也改变

include /etc/nginx/sites-enabled/*;

include /etc/nginx/sites-enabled/*.conf;

这样下次就不会出现这样的问题了

关于ssl - Nginx , LetsEncrypt - [emerg] "ssl_certificate"指令不允许在/etc/nginx/sites-enabled/example.com.conf :33 nginx:,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45960610/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com