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;

}