nginx 配置 https

server {
    listen       80;
    # listen       [::]:80 default_server;
    server_name  www.aaa.com;
    root         /data1/pc/public;javascript

    gzip on;
    gzip_buffers 32 4k;
    gzip_comp_level 6;
    gzip_min_length 200;
    gzip_types text/css text/xml application/javascript;php


    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;css

   return      301 https://$server_name$request_uri;html

    location / {
        index index.php index.html index.htm;java

        if (!-e $request_filename) {nginx

       rewrite ^/(.*)$ /index.php/$1;session


        }app


    }server

    error_page 404 /404.html;
        location = /40x.html {
    }xml

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }

    location ~ \.php(.*)$ {
            # 設置監聽端口
             # include fastcgi.conf;
            fastcgi_pass   127.0.0.1:9000;
            # 設置nginx的默認首頁文件(上面已經設置過了,能夠刪除)
            fastcgi_index  index.php;
               # fastcgi_split_path_info ^(.+\.php)(.*)$;
                fastcgi_param PATH_INFO $1;
            # 設置腳本文件請求的路徑
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            # 引入fastcgi的配置文件
            include        fastcgi_params;
        }

          access_log  /data1/log/pc.log;


}

server {

    listen       443;
    # listen       [::]:80 default_server;
    server_name  www.aaa.com;
    root         /data1/pc/public;
    ssl on;
    ssl_certificate         /etc/nginx/cert/cert-1540201236889_www.aaa.com.crt;
    ssl_certificate_key     /etc/nginx/cert/cert-1540201236889_www.aaa.com.key;
    ssl_session_timeout     5m;
    ssl_ciphers             ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
    ssl_protocols           TLSv1 TLSv1.1 TLSv1.2;
    ssl_prefer_server_ciphers on;

    gzip on;
    gzip_buffers 32 4k;
    gzip_comp_level 6;
    gzip_min_length 200;
    gzip_types text/css text/xml application/javascript;


    # Load configuration files for the default server block.
    include /etc/nginx/default.d/*.conf;

    location / {
        index index.php index.html index.htm;

        if (!-e $request_filename) {

       rewrite ^/(.*)$ /index.php/$1;


        }


    }

    error_page 404 /404.html;
        location = /40x.html {
    }

    error_page 500 502 503 504 /50x.html;
        location = /50x.html {
    }

    location ~ \.php(.*)$ {
            # 設置監聽端口
             # include fastcgi.conf;
            fastcgi_pass   127.0.0.1:9000;
            # 設置nginx的默認首頁文件(上面已經設置過了,能夠刪除)
            fastcgi_index  index.php;
               # fastcgi_split_path_info ^(.+\.php)(.*)$;
                fastcgi_param PATH_INFO $1;
            # 設置腳本文件請求的路徑
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            # 引入fastcgi的配置文件
            include        fastcgi_params;
        }

          access_log  /data1/log/pc.log;

}  

相關文章
相關標籤/搜索