第一步打开服务器找到nginx目录文件,找到nginx.conf文件进行配置
我们只需要找到http所在的那个服务加入一行代码
return 301 https://www.abc.com$request_uri;
就可以将http协议改成https
http{
include mime.types;
server{
charset utf-8;
listen 443 ssl; #端口
server_name abc.com; #网站域名
index index.html ;
root /opt/Blog/MyBlog;
location /static {
alias /opt/Blog/qwe/static;
}
location /media {
alias /opt/Blog/qwe/media;
}
# Finally, send all non-media requests to the Django server.
location / {
uwsgi_pass 127.0.0.1:81;
include /opt/Blog/qwe/uwsgi_params;
}
ssl_certificate bmftbmt.site_bundle.crt; #这几个是对ssl证书进行配置
ssl_certificate_key abc.com.key;
ssl_session_timeout 5m;
ssl_protocols