在运行 Ubuntu 12.10 的 DigitalOcean Droplet、Apache 上安装第三方 SSL。
按照此处的说明进行操作:
所以一切似乎都顺利。我根据上述教程对所有适当的文件进行了编辑,并输入了从 AlphaSSL 获得的证书信息,但当我尝试重新启动时,nginx
我遇到了障碍。
root@omitted:/etc/nginx/sites-available# sudo service nginx restart
Restarting nginx: nginx: [emerg] SSL_CTX_use_certificate_chain_file("/etc/nginx/cert.pem") failed (SSL: error:02001002:system library:fopen:No such file or directory error:20074002:BIO routines:FILE_CTRL:system lib error:140DC002:SSL routines:SSL_CTX_use_certificate_chain_file:system lib)
nginx: configuration file /etc/nginx/nginx.conf test failed
谷歌搜索这个错误让我找到了以下内容服务器故障页面,其中的修复方法是使用以下命令更改目录权限,我这样做了:
sudo mkdir /etc/nginx/ssl
sudo chown -R root:root /etc/nginx/ssl
sudo chmod -R 600 /etc/nginx/ssl
但我仍然收到错误。我想我漏掉了什么。求助。
编辑我刚刚意识到 cert.pem 文件不存在,但我似乎无法弄清楚原因。
这里是/etc/nginx/nginx.conf
:(超长但我不知道该省略什么......)
user www-data;
worker_processes 4;
pid /var/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;
##
# 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 text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript;
##
# nginx-naxsi config
##
# Uncomment it if you installed nginx-naxsi
##
#include /etc/nginx/naxsi_core.rules;
##
# nginx-passenger config
##
# Uncomment it if you installed nginx-passenger
##
#passenger_root /usr;
#passenger_ruby /usr/bin/ruby;
##
# Virtual Host Configs
##
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
#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;
# }
#}
答案1
根据您的错误,似乎nginx
找不到/etc/nginx/cert.pem
文件,我建议您仔细检查路径和权限(切换到 nginx 的用户并尝试读取此文件)。
答案2
只需检查 /etc/nginx/cert.pem 是否存在。并确保认证文件有效。或者您应该重新生成一个新的。