zoukankan      html  css  js  c++  java
  • Centos7下thinkphp5.0环境配置

    首先把yum源修改为阿里的yum源,如果没有安装wget,先安装一个。(如果有请蹦过)

    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
    yum install wget -y

    备份本地yum源

    mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo_bak

    获取阿里yum源配置文件

    wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

    安装epel源

    yum install epel-release

    安装环境

    sudo rpm -Uvh http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
    yum install php php-fpm php-mysql nginx mariadb-server php-gd* -y

    修改php-fpm文件

    vi /etc/php-fpm.d/www.conf

     启动服务

    systemctl start php-fpm
    systemctl start nginx

    简单配置 数据库

    systemctl start mariadb
    mysql_secure_installation
    Enter current password for root (enter for none): #初次运行直接回车
    Set root password? [Y/n] #是否设置root用户密码,输入y并回车或直接回车
    New password: #设置root用户的密码
    Re-enter new password: # 再输入一次你设置的密码
    Remove anonymous users? [Y/n] # 是否删除匿名用户,回车
    Disallow root login remotely? [Y/n] #是否禁止root远程登录,回车,
    Remove test database and access to it? [Y/n] # 是否删除test数据库,回车
    Reload privilege tables now? [Y/n] # 是否重新加载权限表,回车

    root 用户支持远程访问

    grant all privileges on *.* to 'root'@'%' identified by '123456' with grant option;
    flush privileges;

    配置Nginx文件

    新建配置文件

    vi /etc/nginx/conf.d/www.a.com.conf

    文件内容

    server {
    
      listen 80;
      server_name www.a.com;
      set $root /var/www/myweb;
      
      #listen 443 ssl;
      #ssl_certificate *.pem;
      #ssl_certificate_key *.key;
      #ssl_session_timeout 5m;
      #ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE:ECDH:AES:HIGH:!NULL:!aNULL:!MD5:!ADH:!RC4;
      #ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
      #ssl_prefer_server_ciphers on;
      
      location ~ .*.(gif|jpg|jpeg|bmp|png|ico|txt|js|css)$ {
        root $root;
        client_max_body_size 100M;
      }
      location / {
        index index.php;
        if (!-e $request_filename) {
          rewrite ^/(.*)$ /index.php/$1 last;
          break;
        }
        root $root;
        client_max_body_size 100M;
      }
      location ~ .php/?.*$ {
        root $root;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        include fastcgi_params;
    
        set $fastcgi_script_name2 $fastcgi_script_name;
        if ($fastcgi_script_name ~ "^(.+.php)(/.+)$") {
          set $fastcgi_script_name2 $1;
          set $path_info $2;
        }
        fastcgi_param PATH_INFO $path_info;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name2;
        fastcgi_param SCRIPT_NAME $fastcgi_script_name2;
        client_max_body_size 100M;
      }
       include /etc/nginx/mime.types;
        default_type application/octet-stream;
    
      }

    重新加载配置文件

    nginx -s relaod
  • 相关阅读:
    windows的80端口被占用时的处理方法
    Ansible自动化运维工具安装与使用实例
    Tomcat的测试网页换成自己项目首页
    LeetCode 219. Contains Duplicate II
    LeetCode Contest 177
    LeetCode 217. Contains Duplicate
    LeetCode 216. Combination Sum III(DFS)
    LeetCode 215. Kth Largest Element in an Array(排序)
    Contest 176 LeetCode 1354. Construct Target Array With Multiple Sums(优先队列,递推)
    Contest 176
  • 原文地址:https://www.cnblogs.com/dongqiliang/p/12667474.html
Copyright © 2011-2022 走看看