美文网首页
Nginx配置https

Nginx配置https

作者: 墨线宝 | 来源:发表于2023-10-30 11:08 被阅读0次

Nginx配置https

server
    {
        # 监听端口 HTTPS
        listen 443 ssl;
        server_name ably.com;
        
        # 配置域名证书
        # 证书文件
        ssl_certificate      /server/Certs/certificate.crt;
        # 私钥文件
        ssl_certificate_key  /WebServer/Certs/private.key;
        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;
        ssl_protocols SSLv2 SSLv3 TLSv1;
        ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP;
        ssl_prefer_server_ciphers  on;
    
        index index.html index.htm index.php;
        root /data/www/;
        location ~ .*\.(php|php5)?$
        {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            include fastcgi.conf;
        }
        
        # 配置地址拦截转发,解决跨域验证问题
        location /oauth/{
            proxy_pass https://localhost:13580/oauth/;
            proxy_set_header HOST $host;
            proxy_set_header X-Real-IP $remote_addr;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        }
        
        # 图片缓存时间设置
        location ~ .*\.(gif|jpg|jpeg|png|bmp|swf)$ {
            expires 10d;
        }
        
        # JS和CSS缓存时间设置
        location ~ .*\.(js|css)?$ {
            expires 1h;
        }

        # 日志格式设定
        log_format access '$remote_addr - $remote_user [$time_local] "$request" '
        '$status $body_bytes_sent "$http_referer" '
        '"$http_user_agent" $http_x_forwarded_for';
        # 定义本虚拟主机的访问日志
        access_log /var/log/nginx/access.log access;
        
        # 设定查看Nginx状态的地址.StubStatus模块能够获取Nginx自上次启动以来的工作状态,此模块非核心模块,需要在Nginx编译安装时手工指定才能使用
        location /NginxStatus {
            stub_status on;
            access_log on;
            auth_basic "NginxStatus";
            auth_basic_user_file conf/htpasswd;
            #htpasswd文件的内容可以用apache提供的htpasswd工具来产生.
        }
    }

https://zhhll.icu/2021/服务器/Nginx/14.Nginx配置https/

本文由mdnice多平台发布

相关文章

  • # nginx https证书配置

    nginx https证书配置 一 前言 此文档针对于nginx配置反向代理使用https证书方法 nginx作为...

  • nginx https 配置

    nginx https 配置

  • nginx配置https

    nginx配置https https需要的证书我们已经申请到了,下面分享下nginx配置https的一些配置参数!...

  • Nginx配置https请求,以及Nginx+keepalive

    一、Nginx配置https请求 要实现Nginx配置https请求,安装的时候需要加上 --with-http_...

  • nginx配置https

    只配置443会导致http和https共存,只要再80里配置个重定向即可return 301 https://$s...

  • nginx https配置

    本地文件上传到服务器

  • Nginx https 配置

    准备环境阿里云 腾讯云部署好站点,且使用DNS解析到云服务器的IP地址 接下来就是配置HTTPS的关键步...

  • Nginx配置HTTPS

  • Nginx 配置 https

    从云服务提供商处申请证书 申请 https 证书教程-百度经验 申请下来的证书目录结构 下文中只拿 Nginx 来...

  • NGINX 配置 HTTPS

    首先是下载证书,我的是再阿里云里面,如果购买成功了,直接下载证书。里面会有两后缀分别为.key和.pem的个文件,...

网友评论

      本文标题:Nginx配置https

      本文链接:https://www.haomeiwen.com/subject/qzsbidtx.html