一:
由于公司业务属于请求量比较大的吧,每个月几亿条,考虑到安全性,所以需要域名由http改为https,cdn加速才可以支成撑业务。
二:
之前的系统是使用lamp配置的,这次以nginx为示例:
nginx配置:
server {
listen 443;
server_name xxx.com; # localhost修改为您证书绑定的域名。
ssl on; #设置为on启用SSL功能。
root html;
index index.html index.htm;
ssl_certificate .pem路径; #将domain name.pem替换成您证书的文件名。
ssl_certificate_key .key路径; #将domain name.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;
# location / {
# root html;
# index index.html index.htm;
# }
location / {
proxy_pass https://xxx.com;
index index.html index.htm index.php;
root 项目路径;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php/?s=$1 last; # TP rewrite模式
break;
}
# 显示真实ip地址
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
autoindex on;
}
location ~ \.php {
root 项目路径;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
两个文件为aliyun上面下载的免费的证书,路径为在你nginx路径下新建cert文件夹,放入即可
配置完后重启nginx
systemctl restart nginx.service
三:
咱们既然做cdn加速,就要有域名加速,给你的域名备案,我这里就不赘述了。
cdn aliyun配置:
配置完成后你会获取一个cname,域名解析用的到
域名解析:
解析完成后就可以访问带https的cdn加速的访问了
设置nginx重启:systemctl enable nginx.service