阿里云配置https
首先申请ssl证书,地址
https://common-buy.aliyun.com/?spm=5176.7968328.1120760.1.6afc1232ACQ3Zd&commodityCode=cas#/buy
阿里云很心机的让你怎么点都点不到免费的.经过指点.
正确顺序如下-----symantec---->一个域名------->免费版
刚进入时是这个页面
回到证书控制台,补全资料,域名验证类型选择dns,然后等待审核.
我的域名也是阿里云买的,所以补全资料选择DNS下面勾选自动添加一条解析记录.
其实应该就是证明域名是你的,两种方式1.DNS就是添加一条解析记录2.域名指向根目录放入一个文件
证书签发成功后,会发短信和邮件通知.
进入控制台的ssl证书页面
点击下载
选择你使用的发布软件,按照他的教程做就好了.
我的是lnmp集成环境.用的NGINX,这里有个坑,阿里云说的cert目录建在NGINX安装目录,cert实际在conf下面,****是对的.
然后,重启NGINX,访问.
是的 果不其然 无法访问.......
这里写一个新的坑,阿里云443端口没开,进入ecs->实例->管理->安全组->配置规则->添加安全组规则 加入443端口
重启 刷新 OK
HTTPS正常访问
server
{
#listen 80;
#开启https支持
listen 443;
ssl on;
ssl_certificate cert/214844772740615.pem;
ssl_certificate_key cert/214844772740615.key;
server_name www.sunhongfei.top; #可以是ip或者域名
index index.php index.html index.htm default.html default.htm default.php;
root /home/wwwroot/default/public; #根路径根据自己情况修改
location ~ [^/]\.php(/|$)
{
try_files $uri =404;
#使用不同的与php-fpm通信方式
fastcgi_pass unix:/tmp/php-cgi.sock;
fastcgi_index index.php;
include fastcgi.conf;
}
location /status {
stub_status on;
access_log off;
}
location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$
{
expires 30d;
}
location ~ .*\.(js|css)?$
{
expires 12h;
}
access_log off;
}
#强制让http请求跳转到https
server{
listen 80;
server_name www.sunhongfei.top;
rewrite ^(.*) https://$server_name$1 permanent;
}
配置结束后 切记 切记 !!!!!
如果你在nginx.conf中没有设置域名绑定或者设置了 此时似乎就没用了 伪静态和pathinfo模式要重新设置
还有我接了一个地图在项目中 突然地图加载不出来 BMap不存在
不要和我扯淡 孩子 后来发现 引用的地图文件是http 要改成https 都是什么情况