centos7阿里云服务器域名配置https,用的免费Symantec证书
技术  /  管理员 发布于 2年前   697
先登录阿里云 进SSL证书->点击购买证书 直接先免费版的
2.点击申请 填一下信息 过一会状态变成已签发就能用了
3.下载证书
4. 上传证书文件到服务器 一般在nginx安装目录就行自己定 我放在这里
[root@iz8vbcrus31oj2axurgpjyz ~]# cd /usr/local/nginx/conf/cert/
[root@iz8vbcrus31oj2axurgpjyz cert]# ll
total 8
-rw-r--r-- 1 root root 1679 Apr 7 14:37 3641582xxx.key
-rw-r--r-- 1 root root 3675 Apr 7 14:37 3641582xxx.pem
[root@iz8vbcrus31oj2axurgpjyz cert]#
5.配置nginx
[root@iz8vbcrus31oj2axurgpjyz vhost]# cat www.conf
server
{
listen 443 ssl;
server_name xxx;
ssl_certificate /usr/local/nginx/conf/cert/3641582xxx.pem;
ssl_certificate_key /usr/local/nginx/conf/cert/3641582xxx.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;
ssl_prefer_server_ciphers on;
index index.html index.htm index.php;
root /xxxx;
location / {
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=/$1 last;
break;
}
}
#error_page 404 /404.html;
include enable-php.conf;
location /nginx_status
{
stub_status off;
access_log off;
}
}
server
{
listen 80 default;
server_name xxxx;
#把http的域名请求转成https
#rewrite ^(.*)$ https://$host$1 permanent;
6.重载nginx配置文件
/usr/local/nginx/sbin/nginx -t
/usr/local/nginx/sbin/nginx -s reload
7.这里就完事了,如果是阿里云服务器的话 必须开放443端口 控制面板->云服务器ECS
博主 在
2023年国务院办公厅春节放假通知:1月21日起休7天中评论 @ xiaoB 你只管努力,剩下的叫给天意;天若有情天亦老,..xiaoB 在
2023年国务院办公厅春节放假通知:1月21日起休7天中评论 会不会春节放假后又阳一次?..BUG4 在
你翻墙过吗?国内使用vpn翻墙可能会被网警抓,你需了解的事中评论 不是吧?..博主 在
go语言+beego框架中获取get,post请求的所有参数中评论 @ t1 直接在router.go文件中配就ok..Jade 在
如何在MySQL查询中获得当月记录中评论 Dear zongscan.com team, We can skyroc..
Copyright·© 2019 侯体宗版权所有·
粤ICP备20027696号