关于centos:55nginxconfhttps-nginx配置https

40次阅读

共计 1104 个字符,预计需要花费 3 分钟才能阅读完成。


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {worker_connections  1024;}


http {
    include       mime.types;
    default_type  application/octet-stream;

    #log_format  main  '$remote_addr - $remote_user [$time_local]"$request" '
    #                  '$status $body_bytes_sent"$http_referer" '
    #                  '"$http_user_agent" "$http_x_forwarded_for"';

    #access_log  logs/access.log  main;

    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
    keepalive_timeout  65;

    #gzip  on;




    # HTTPS server
    #
    server {
        listen       443 ssl;
        server_name  ql.gaojilaochacang.com;

        ssl_certificate      /home/gpkey/gp.pem;
        ssl_certificate_key  /home/gpkey/gp.key;

        ssl_session_cache    shared:SSL:1m;
        ssl_session_timeout  5m;

        ssl_ciphers  HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers  on;

        location / {
            proxy_pass  http://127.0.0.1:8080;
            proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
            proxy_set_header Host $host;
            proxy_set_header X-Forwarded-Proto https;
            proxy_http_version 1.1;
            # for websocket 
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection "upgrade";
        }
    }
    
    server {
        listen 80;
        server_name ql.gaojilaochacang.com;
        #将申请转成 https
        rewrite ^(.*)$ https://$host$1 permanent;
    }

}

正文完
 0