申请免费的阿里云 SSL 证书
首先参考这里申请一个免费的阿里云 SSL 证书
Nginx 配置
将 Nginx 对应的证书下载到服务器上,配置参考
server {
listen 80;
server_name xxx.sunzhongwei.com;
return 301 https://xxx.sunzhongwei.com$request_uri;
}
server {
listen 443;
server_name xxx.sunzhongwei.com;
root /xxx/public;
index index.html index.htm index.php;
ssl on;
ssl_certificate /xxx/storage/cert/xxx.sunzhongwei.com.pem;
ssl_certificate_key /xxx/storage/cert/xxx.sunzhongwei.com.key;
ssl_session_timeout 5m;
ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2; # Dropping SSLv3, ref: POODLE
ssl_prefer_server_ciphers on;
access_log /var/log/nginx/xxx-access.log access;
error_log /var/log/nginx/xxx-error.log;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
}
}
微信关注我哦 👍
我是来自山东烟台的一名开发者,有感兴趣的话题,或者软件开发需求,欢迎加微信 zhongwei 聊聊, 查看更多联系方式