Apache-2.2
由於/etc/nginx/nginx.conf測試失敗導致nginx服務重啟失敗
在執行 Ubuntu 12.10 的 Apache 上安裝第 3 方 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
Google搜尋此錯誤導致我進入以下伺服器故障頁面,其中修復是使用以下內容更改目錄權限,我這樣做了:
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; # } #}
根據您的錯誤,似乎
nginx
找不到/etc/nginx/cert.pem
文件,我建議您仔細檢查路徑和權限(切換到 nginx 的使用者並嘗試閱讀此文件)。
只需檢查 /etc/nginx/cert.pem 是否存在。並確保認證文件有效。或者你應該重新生成一個新的。