さくらのVPSのスタートアップスクリプトを利用しOSを再インストールしました。
CentOS7
Nginx
Let’s Encrpt
の設定が自動でインストールされるサービスのようです。(全てインストール済みでした。)
インストール完了後、鍵認証の設定、firewallでssh,http,httpsの設定を済ませました。
DNSの設定も完了し
http://www.example.comでアクセスすると Welcome to nginx! と表示されました。
次に SSL通信が出来るか確認しようと
https://www.example.comでアクセスするとつながりません。
以下で確認したところNginxで443ポートの指定がされていないため通信出来ていないというのはわかりました。
# netstat -ltupn Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1/systemd tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 1818/nginx: master tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 17557/master tcp 0 0 0.0.0.0:52368 0.0.0.0:* LISTEN 18061/sshd udp 0 0 0.0.0.0:111 0.0.0.0:* 1/systemd udp 0 0 127.0.0.1:323 0.0.0.0:* 16852/chronyd udp6 0 0 ::1:323 :::* 16852/chronyd
以下で確認しても80番ポートの設定しかありませんでした。
/etc/nginx/conf.d/default.conf server { listen 80; server_name localhost; #charset koi8-r; #access_log /var/log/nginx/host.access.log main; location / { root /usr/share/nginx/html; index index.html index.htm; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/share/nginx/html; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ .php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # #location ~ .php$ { # root html; # fastcgi_pass 127.0.0.1:9000; # fastcgi_index index.php; # fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; # include fastcgi_params; #} # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /.ht { # deny all; #} }
サイトで443ポートの設定方法を検索したところ以下のように設定すればいいみたいなので打ち込もうとしましたが
SSL証明書の指定(2カ所)があり、確認しようと
# vim /etc/pki/tls/certs/server.crt # vim /etc/pki/tls/certs/server.key など他にもサイトを参考にいろいろ打ち込んでみましたが、新規ファイルの立ち上げでした。
と打ち込んでみましたが、どちらも新規のファイルが開かれます。(ファイルが無いようです)
以下のように設定したいのですがSSL証明書のパスがわかりません。
# HTTPS server # server { listen 443 ssl; # server_name localhost; server_name www.mk-mode.com; ssl on; # ssl_certificate cert.pem; ssl_certificate /etc/pki/tls/certs/server.crt; # ssl_certificate_key cert.key; ssl_certificate_key /etc/pki/tls/certs/server.key; ssl_session_cache shared:SSL:1m; ssl_session_timeout 5m; ssl_ciphers HIGH:!aNULL:!MD5; ssl_prefer_server_ciphers on; location / { root html; index index.html index.htm; } }
さくらのVPSのスタートアップスクリプトでLet's Encryptを導入した場合のSSL証明書はどこのファイルに保存されているのでしょうか?
サーバー証明書のパス と 秘密鍵のパスを知りたいのですが探す方法を教えて頂けないでしょうか?
ssl_certificate と ssl_certificate_key の指定方法などについても教えていただけないでしょうか?
宜しくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/04/02 03:00