码迷,mamicode.com
首页 > Web开发 > 详细

nginx+php+redis+ssl 配置

时间:2019-12-08 17:36:28      阅读:114      评论:0      收藏:0      [点我收藏+]

标签:listen   ati   ica   安装   sha   http2   pdo   release   eve   

php的接触得很少,记录一下
环境:CentOS 7.4

安装软件

# 安装 nginx
yum install nginx

# 配置PHP7的源,安装 PHP 7.0 及扩展
yum install epel-release
yum install php70w-fpm php70w-cli php70w-gd php70w-mcrypt php70w-mysql php70w-pear php70w-xml php70w-mbstring php70w-pdo php70w-json php70w-pecl-apcu php70w-pecl-apcu-devel 

# 安装 redis 及 redis 扩展
yum install php70w-pecl-redis redis

配置网站 /etc/nginx/conf.d/www.conf

server {
        listen 80;
        server_name klvchen.com www.klvchen.com;
        rewrite ^(.*)$ https://$host$1 permanent;
}
server {
        listen 443 ssl http2;
        server_name klvchen.com www.klvchen.com;

        ssl_certificate /etc/nginx/cert/3177653_klvchen.com.pem;
        ssl_certificate_key /etc/nginx/cert/3177653_klvchen.com.key;
        ssl_session_timeout 5m;
        ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
        ssl_session_cache shared:SSL:1m;
        ssl_ciphers HIGH:!aNULL:!MD5;
        ssl_prefer_server_ciphers on;
        fastcgi_param HTTPS on;
        fastcgi_param HTTP_SCHEME https;

        root /data/web/thinkphp_5.0.15_full/public;
        location / {
                index index.html index.php;
                if (!-e $request_filename) {
                         rewrite ^/(.*)$ /index.php?s=$1 last;
                }
        }

        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;
        }
}

测试 phpinfo.php

<?php
    phpinfo();
?>

nginx+php+redis+ssl 配置

标签:listen   ati   ica   安装   sha   http2   pdo   release   eve   

原文地址:https://www.cnblogs.com/klvchen/p/12006071.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!