• 在linux nginx服务器上,给内网ip配置https


    1)安装OpenSSL

    //yum install mod_ssl openssl

    yum -y install openssl openssl-devel

    mkdir /etc/pki/nginx

    cd /etc/pki/nginx

    2)生成私钥和自签证书

    openssl req -newkey rsa:2048 -nodes -keyout rsa_private.key -x509 -days 365 -out cert.crt -subj "/C=CN/ST=GD/L=SZ/O=vihoo/OU=dev/CN=127.0.0.1/emailAddress=yy@qq.com"

    #监听443端口

    server {
            listen       443 ssl http2 default_server;
            listen       [::]:443 ssl http2 default_server;
    #        server_name  _;
            root         /var/www/html;
    
            ssl_certificate "/etc/pki/cert.crt";
            ssl_certificate_key "/etc/pki/rsa_private.key";
            ssl_session_timeout  10m;
            ssl_ciphers HIGH:!aNULL:!MD5;
            ssl_prefer_server_ciphers on;
    #
    #        # Load configuration files for the default server block.
    #        include /etc/nginx/default.d/*.conf;
    #
            location / {
            }
          
            location ~ .php$ {
               root           /var/www/html;
                    index index.html index.php;
               fastcgi_pass   127.0.0.1:9000;
               fastcgi_index  index.php;
               fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
               include        fastcgi_params;
           }
            error_page 404 /404.html;
                location = /40x.html {
            }
    #
            error_page 500 502 503 504 /50x.html;
                location = /50x.html {
            }
        }

    6、重启nginx生效

    systemctl restart nginx

  • 相关阅读:
    p3201&bzoj1483 梦幻布丁
    p1341 无序字母对
    p2590&bzoj1036 树的统计
    p1462 通往奥格瑞玛的道路
    p1522 牛的旅行 Cow Tours
    ARC097D Equals
    p2371&bzoj2118 墨墨的等式
    ARC097C K-th Substring
    欧拉函数入门合集(模板)
    主席树
  • 原文地址:https://www.cnblogs.com/hualingyun/p/14596094.html
Copyright © 2020-2023  润新知