×

CentOS7.0+PHP7+Nginx+Mysql5.7环境安装

96
波哥
2016.03.23 15:08* 字数 110

一. 系统

更新

yum -y update

二. 安装nginx

创建文件

    vim /etc/yum.repos.d/nginx.repo

文件内容,这配置是安装最新的稳定版1.8

[nginx]
name=nginx repo
baseurl=http://nginx.org/packages/centos/7/$basearch/
gpgcheck=0
enabled=1

然后

  yum -y install nginx

检查是否安装成功

  systemctl start nginx

访问你的ip

三.安装Mysql5.7

下载mysql的repo源

wget http://repo.mysql.com//mysql57-community-release-el7-7.noarch.rpm

安装mysql-community-release-el7-7.noarch.rpm包

 sudo rpm -Uvh mysql57-community-release-el7-7.noarch.rpm

安装msyql

sudo yum install mysql-server

重启mysql

service mysqld restart

查看临时密码

sudo grep 'temporary password' /var/log/mysqld.log

修改密码

ALTER USER 'root'@'localhost' IDENTIFIED BY 'YourNewPass4!';

四.安装php7

webtatic方式

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum install php70w php70w-opcache php70w-fpm

五.nginx配置

这是laravel配置


server{
        listen 80;
        server_name lara.0003688.com;

    root /home/www/laravel/public;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }


    location ~ \.php$ {
        try_files $uri /index.php =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

}

如果显示空白可能是

  chmod -R 777 storage
clipboard.png

完成

web技术
Web note ad 1