zoukankan      html  css  js  c++  java
  • nginx+php+redis+ssl 配置

    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();
    ?>
    
  • 相关阅读:
    jquery 序列化form表单
    nginx for windows 安装
    nodejs idea 创建项目 (一)
    spring 配置 shiro rememberMe
    idea 2018 解决 双击shift 弹出 search everywhere 搜索框的方法
    redis 在windows 集群
    spring IOC控制反转和DI依赖注入
    redis 的安装
    shiro 通过jdbc连接数据库
    handlebars的用法
  • 原文地址:https://www.cnblogs.com/klvchen/p/12006071.html
Copyright © 2011-2022 走看看