2
我有本地運行的Ruby on Rails應用程序。然後,我也在本地運行一個nginx服務器。現在,連接可以在HTTP上正常工作,但是當我嘗試通過HTTPS連接時,我得到了來自nginx的「502 Bad Gateway」錯誤。我很確定證書工作正常,因爲當他們不是,我有一個不同的錯誤,但現在我的nginx配置有問題?這裏的配置:獲取HTTPS連接以使用本地Rails應用程序和nginx?
http {
access_log off;
#include mime.types;
default_type application/octet-stream;
upstream mydomain.com {
server 127.0.0.1:8080;
}
server {
listen 80;
server_name local www.local;
location/{
proxy_pass http://mydomain.com;
}
add_header Pragma "no-cache";
}
server {
listen 443;
server_name local www.local;
ssl on;
ssl_certificate /Users/daise/projects/mydomain/run/ssl/server.crt;
ssl_certificate_key /Users/daise/projects/mydomain/run/ssl/server.key;
location/{
proxy_set_header X-FORWARDED_PROTO https;
#proxy_pass https://mydomain.herokuapp.com;
proxy_pass https://mydomain.com;
}
add_header Pragma "no-cache";
}
}
我還要補充一點,我欺騙我的/ etc/hosts文件來解決爲127.0.0.1