其他分享
首页 > 其他分享> > nignx 配置https

nignx 配置https

作者:互联网

 server {
    listen    80;
    server_name    down.lizhanqi.top share.lizhanqi.top;
    rewrite ^(.*) https://$server_name$1 permanent; # 这里重定向到https
}
server 
{
    listen 443 ssl;
    server_name  down.lizhanqi.top; 
    index index.php index.html index.htm default.php default.htm default.html;
    root C:/www/share;
    ssl_certificate C:/BtSoft/nginx/conf/2_down.lizhanqi.top.crt;
    ssl_certificate_key C:/BtSoft/nginx/conf/3_down.lizhanqi.top.key;
    ssl_ciphers  HIGH:!aNULL:!MD5;  # 选择加密套件
    ssl_prefer_server_ciphers  on;  # 设置协商加密算法时,优先使用我们服务端的加密套件,而不是客户端浏览器的加密套件。
     
     
     autoindex on; #开启目录浏览
     autoindex_format html; #以html风格将目录展示在浏览器中
     autoindex_exact_size off; #切换为 off 后,以可读的方式显示文件大小,单位为 KB、MB 或者 GB
     autoindex_localtime on; #以服务器的文件时间作为显示的时间
   #  charset gbk;#展示中文文件名
    
    
    
		
	#START-ERROR-PAGE
	#error_page 403 /403.html;
	error_page 404 /404.html;
    #error_page 502 /502.html;
	#END-ERROR-PAGE
    
    #HTTP_TO_HTTPS_START
    #HTTP_TO_HTTPS_END
	#location / {
	#charset utf-8;
#	}




    #SECURITY-START 防盗链配置
    location ~ .*\.(jpg|jpeg|gif|png|js|css)$
    {
        expires      30d;
        access_log off;
        valid_referers none blocked share.lizhanqi.top ftp.lizhanqi.top;
        if ($invalid_referer){
            return 404;
        }
    }
    #SECURITY-END

    #LIMIT_INFO_START  
    #LIMIT_INFO_END

    #SSL-INFO-START
    #SSL-INFO-END
        
    #反代清理缓存配置
    location ~ /purge(/.*) {
        proxy_cache_purge cache_one $1$is_args$args;
    }
    #proxy 反向代理
    include proxy/share.lizhanqi.top/*.conf;

    #PHP-INFO-START 
    include php/00.conf;
    #PHP-INFO-END
    
    #REWRITE-START
    include rewrite/share.lizhanqi.top/*.conf;
    #REWRITE-END

    #redirect 重定向
    include redirect/share.lizhanqi.top/*.conf;

    #禁止访问的文件或目录
   location ~ ^/(\.user.ini|\.htaccess|\.git|\.svn|\.project|LICENSE|README.md)
    {
        return 404;
    } 
    
    #一键申请SSL证书验证目录相关设置
    location ~ \.well-known{
        allow all;
    }

	access_log  C:/BtSoft/wwwlogs/share.lizhanqi.top.log;
    error_log  C:/BtSoft/wwwlogs/share.lizhanqi.top.error.log;
}

标签:END,START,top,配置,share,nignx,html,https,lizhanqi
来源: https://www.cnblogs.com/lizhanqi/p/15216558.html