Nginx服务器SSL证书安装和配置YII2,成功之后可用https访问

server {

    listen 443;

    server_name baidu.com; #填写绑定证书的域名

    ssl on;

    ssl_certificate /usr/local/nginx/conf/1_baidu.com_bundle.crt; //crt绝对路径

    ssl_certificate_key /usr/local/nginx/conf/2_baidu.com.key;//证书秘钥

    ssl_session_timeout 5m;

    ssl_protocols TLSv1 TLSv1.1 TLSv1.2; #按照这个协议配置

    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:HIGH:!aNULL:!MD5:!RC4:!DHE;#按照这个套件配置

    ssl_prefer_server_ciphers on;

    root  /var/www/html/yii2/api/web;

    index  index.php;//根据情况设定,index.html htm等

    location ~* \.(eot|otf|ttf|woff)$ {

      add_header Access-Control-Allow-Origin *;

    }

    location / {

        try_files $uri $uri/ /index.php?$args;

    }

    location ~ \.php$ {

        include  fastcgi_params;

        fastcgi_index    index.php;

        fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

        fastcgi_pass  127.0.0.1:9000;

        try_files $uri =404;

    }

}

你可能感兴趣的:(Nginx服务器SSL证书安装和配置YII2,成功之后可用https访问)