我已經在亞馬遜證書管理器中申請了證書。現在它具有「已發佈」狀態。 在EC2控制檯中,我創建了Load Balancer。有2個聽衆:HTTP和HTTPS。我嘗試了應用程序負載平衡器和經典負載平衡器,但無法通過HTTPS連接到我的站點。如何使用Elastic Load Balancer在Amazon EC2上設置HTTPS
我的nginx的配置:
server {
listen 80;
#listen 443 ssl;
rewrite ^(.*) https://$host$1 permanent;
server_name site.com www.site.com;
root /home/ubuntu/www/site.com/wordpress;
index index.php;
client_max_body_size 20m;
gzip on;
gzip_disable "msie6";
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript application/javascript;
location ~* ^/(\.htaccess|xmlrpc\.php)$ {
return 404;
}
location ~ /\. {
deny all;
}
location ~* /(?:uploads|files)/.*\.php$ {
deny all;
}
location ~* ^.+\.(ogg|ogv|svg|svgz|eot|otf|woff|mp4|ttf|rss|atom|jpg|jpeg|gif|png|ico|zip|tgz|gz|rar|bz2|doc|xls|exe|ppt|tar|mid|midi|wav|bmp|rtf)$ {
access_log off;
log_not_found off;
expires max;
}
location/{
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
set $is_https 'off';
if ($http_x_forwarded_proto ~ 'https') {
set $is_https 'on';
}
proxy_set_header HTTPS $is_https;
proxy_redirect off;
if (!-f $request_filename) {
proxy_pass http://app_server;
break;
}
#try_files $uri $uri/ /index.php?$args; # permalinks
}
location ~ \.php$ {
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
如何導入手動證書?或者有一種方法可以設置與Amazon證書的HTTPS連接? ( - sqlbot H/T @邁克爾)
您是否將證書設置爲ELB? Doc在這裏:http://docs.aws.amazon.com/elasticloadbalancing/latest/classic/elb-add-or-delete-listeners.html – minamijoyo
@minamijoyo是的,我做到了。我需要配置後端實例身份驗證(可選)嗎? –
不,您不需要後端身份驗證。在nginx訪問或錯誤日誌中是否有輸出? – minamijoyo