我有一個密鑰,證書和鏈證書。 該域看起來像automation.mydomain.comNGINX配置代理到Sinatra服務器的SSL請求
我有一個Sinatra服務器上運行localhost:3000
,通過curl localhost:3000/test
確認。
我想端口80和443端口流量重定向到3000。這是我的/etc/sites-enabled/sinatra
配置:
upstream app_aggregator {
server 127.0.0.1:3000;
keepalive 8;
}
# the nginx server instance
server {
listen 0.0.0.0:80;
server_name automation.mydomain.com my_site;
access_log /var/log/nginx/aggregator.log;
# pass the request to the node.js server with the correct headers
# and much more can be added, see nginx config options
location/{
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
proxy_pass http://app_aggregator/;
proxy_redirect off;
}
}
注意上述不起作用(http://automation.mydomain.com/結果ERR_NAME_NOT_RESOLVED
)。我不知道如何將密鑰,普通證書和連鎖證書添加到該混合中。
我以前用一個node.js配置解決了這個問題,它愉快地使用了密鑰並且SSL工作得很好,但是我從來沒有用過nginx。
值得注意的是,我使用的是Amazon AWS,只有80和443打開。