nginx上需要监听443端口,同时做了个跳转。主要是证书地址要对,不然会失败。
阿里云里面已经写的很清楚了,这里做个记录。
server {
listen 80;
server_name www.123.com;
return 301 https://$host$request_uri;
}
server{
listen 443;
server_name www.123.com;
access_log /var/log/nginx/www.123.com.access.log main;
error_log /var/log/nginx/www.123.com.error.log info;
ssl on;
root /home/html;
index index.php index.html index.htm;
ssl_certificate /etc/nginx/cert/2145****.pem;
ssl_certificate_key /etc/nginx/cert/2145****.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE****H:!RC4;
ssl_protocols T***v1.2;
ssl_prefer_server_ciphers on;
location / {
root /home/html;
index index.php index.html index.htm;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
location ~ \.php$ {
root /home/html;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}