phpstudy配置nginx支持https

我们两清 提交于 2020-02-08 09:38:33

1、将phpstudy切换成 nginx+php+mysql 环境

2、然后在 vhosts.conf 增加如下配置:

server {
        listen   80;
        server_name  798ziyuan.com;
        root   "C:/ruanjian/PHPStudy/PHPTutorial/WWW";

        autoindex on;   #开启nginx目录浏览功能
        autoindex_exact_size off;   #文件大小从KB开始显示
        autoindex_localtime on;   #显示文件修改时间为服务器本地时间


        location / {
            index  index.html index.htm index.php;
            #autoindex  on;
        }
        location ~ \.php(.*)$ {
            fastcgi_pass   127.0.0.1:9000;
            fastcgi_index  index.php;
            fastcgi_split_path_info  ^((?U).+\.php)(/?.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
            fastcgi_param  PATH_INFO  $fastcgi_path_info;
            fastcgi_param  PATH_TRANSLATED  $document_root$fastcgi_path_info;
            include        fastcgi_params;
        }
}





server {
        listen       443;
        root   "C:/ruanjian/PHPStudy/PHPTutorial/WWW";
        server_name  798ziyuan.com www.798ziyuan.com;

        autoindex on;   #开启nginx目录浏览功能
        autoindex_exact_size off;   #文件大小从KB开始显示
        autoindex_localtime on;   #显示文件修改时间为服务器本地时间

        ssl                  on;
        ssl_certificate      www.798ziyuan.com/full_chain.pem;
        ssl_certificate_key  www.798ziyuan.com/private.key;

        ssl_session_timeout  5m;
        ssl_protocols  SSLv2 SSLv3 TLSv1 TLSv1.1 TLSv1.2;
        ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
        ssl_prefer_server_ciphers   on;

        location / {
            #root   html;
            index  index.html index.htm  index.php;
        }

        location = /favicon.ico {
            log_not_found off; access_log off;
        }

}

备注:
1、这边的ssl证书是放在 vhosts.conf同级目录下,就是 C:\ruanjian\PHPStudy\PHPTutorial\nginx\conf

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!