我有一個 apache 網站伺服器,它在 nginx 伺服器前面託管一個帶有 ssl 憑證的網站,該伺服器也託管一個網站(nodejs)但沒有 ssl。我想將 nginx 上託管的網域配置為也有 ssl,但我不明白。 nginx伺服器設定如下:
server {
listen 8080;
server_name example.com www.example.com;
location / {
proxy_pass http://127.0.0.1:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
apache2.conf 像這樣:
<VirtualHost MYIPADDRESS:80>
ServerName example.com
ServerAlias *.example.com
ErrorLog /var/www/httpd-logs/example.com.error.log
ProxyPass / http://example.com:8080/
ProxyPassReverse / http://example.com:8080/
SSLProxyEngine On
SSLProxyCheckPeerCN on
SSLProxyCheckPeerExpire on
ServerAdmin [email protected]
</VirtualHost>
我嘗試了很多方法,但最終總是破壞 apache 託管網域,我希望有人可以提供幫助。
答案1
將 apache 移轉到 nginx 就完成了這項工作。