|
# 配置remi源 walle依赖5.4以上的版本php才能运行。
[iyunv@walle ~]# cat /etc/yum.repos.d/remi.repo
[remi]
name=Remi’s RPM repository for Enterprise Linux 7 – $basearch
mirrorlist=http://rpms.remirepo.net/enterprise/6/remi/mirror
enabled=1
gpgcheck=0
[remi-php56]
name=Remi’s PHP 5.6 RPM repository for Enterprise Linux 7 – $basearch
mirrorlist=http://rpms.remirepo.net/enterprise/6/php56/mirror
enabled=1
gpgcheck=0
# 创建用户 以便后面创建nginx用户的密钥
[iyunv@walle ~]# useradd nginx
# 安装软件包
[iyunv@walle ~]# yum -y install nginx php-fpm php-mysql php-mbstring mariadb-server composer
# 修改php-fpm配置文件
[iyunv@walle ~]# sed -i 's/user = apache/user = nginx/' /etc/php-fpm.d/www.conf
[iyunv@walle ~]# sed -i 's/group = apache/group = nginx/' /etc/php-fpm.d/www.conf
# 配置mysql
[iyunv@walle ~]# service mysqld start
[iyunv@walle ~]# mysql -e 'CREATE DATABASE walle'
[iyunv@walle ~]# mysql -e "GRANT ALL ON walle.* TO walle@'localhost'>
# 创建网页文件目录
[iyunv@walle ~]# mkdir /data/www -pv
# 下载walle项目源代码
[iyunv@walle ~]# cd /data/www/
[iyunv@walle webdata]# git clone https://github.com/meolu/walle-web.git
# 修改项目文件的属主和属组,
[iyunv@walle webdata]# chown -R nginx.nginx walle-web/
# 设置mysql链接。修改项目目录下的config/local.php中的第12行和第13行
[iyunv@walle webdata]# cd walle-web
[iyunv@walle walle-web]# cat config/local.php
...
'username' => isset($_ENV['WALLE_DB_USER']) ? $_ENV['WALLE_DB_USER'] : 'walle',
'password' => isset($_ENV['WALLE_DB_PASS']) ? $_ENV['WALLE_DB_PASS'] : 'wallepass',
...
# 安装vendor
[iyunv@walle walle-web]$ composer install --prefer-dist --no-dev --optimize-autoloader -vvvv
# 将bower-asset目录改名
[iyunv@walle walle-web]# cd vendor/
[iyunv@walle vendor]# cp -a bower-asset/ bower
# 初始化walle
[iyunv@walle walle-web]# ./yii migrate/up
# 或者
[iyunv@walle walle-web]# ./yii walle/setup # 需要你的yes
# 为nginx提供以下配置,确保/etc/nginx/conf.d/walle.conf配置文件中存在以下内容
server {
listen 8080;
server_name walle.evescn.com; # 改你的host
root /data/www/walle-web/web; # 根目录为web
index index.php index.html;
# 建议放内网
# allow 192.168.0.0/24;
# deny all;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ \.php$ {
try_files $uri = 404;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
# 启动nginx
[iyunv@walle ~]# systemctl start nginx
[iyunv@walle ~]# systemctl enable nginx
# 启动php-fpm
[iyunv@walle ~]# systemctl start php-fpm
[iyunv@walle ~]# systemctl enable php-fpm |
|
|
|
|
|
|