nginx + php + https 配置

Posted 五更

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了nginx + php + https 配置相关的知识,希望对你有一定的参考价值。

server {
        listen 80;
        server_name   你的域名或IP;
        rewrite ^(.*)$  https://$host$1 permanent;
}

server {
        listen 443 ssl;
        server_name 你的域名或IP;
        root 站点文件路径;
        index index.php index.html;

        ssl_certificate   证书.pem文件路径;
        ssl_certificate_key  证书.key文件路径;

        location ~ .php$ {
                fastcgi_pass   127.0.0.1:9000;
                fastcgi_index  index.php;
                fastcgi_param  SCRIPT_FILENAME $document_root$fastcgi_script_name;
                include        fastcgi_params;
        }
}

以上是关于nginx + php + https 配置的主要内容,如果未能解决你的问题,请参考以下文章

(转)mac 搭建基于RTMP的本地Nginx服务器报错homebrew/nginx was deprecated. This tap is now empty as all its form(代码片

nginx+php 开启https

zabbix_配置Nginx连接php

Docker快速搭建PHP+Nginx+Mysql环境(https://notemi.cn/docker-quickly-set-up-php-nginx-mysql-environment.html

nginx配置phpredisadmin无法正常运行

解决Nginx php-fpm配置有误引起的502错误