安装lnmp环境,建议使用centos7 yum安装,因为centos7 yum源默认支持Php5.4以上版本,避免walle系统不兼容
yum install -y mariadb mariadb-server nginx php php-bcmath php-fpm php-gd* php-json freetype freetype-devel php-mbstring php-mcrypt php-mysql php-opcache php-pdo php-pdo_dblib php-pgsql php-recode php-snmp php-soap php-xml php-pecl-zip mhash libmcrypt libmcrypt-devel
mkdir -p /data/www/walle-web && cd/data/www/walle-web # 新建目录
下载walle-web-master.zip并解压(下载地址:https://github.com/meolu/walle-web)
unzip walle-web-master.zip
cd walle-web-master
MariaDB [(none)]> create database wallecharset=utf8mb4 collate utf8mb4_unicode_ci;
MariaDB [(none)]> grant all privileges onwalle.* to 'walleuser'@'%' identified by 'wallepass';
修改walle的web连接
vim /data/www/walle-web/walle-web-master/config/local.php +14
'db' => [
'dsn' =>'mysql:host=127.0.0.1;dbname=walle', # 新建数据库walle
'username' =>'username', # 连接的用户名
'password' =>'password', # 连接的密码
],
curl -sS https://getcomposer.org/installer |php
mv composer.phar /usr/local/bin/composer #PATH目录
cd /data/www/walle-web/walle-web-master
composer install --prefer-dist --no-dev--optimize-autoloader -vvvv
安装速度慢或失败,可直接下载vendor解压到项目根目录(即/data/www/walle-web/walle-web-master目录下)
cd /data/www/walle-web/walle-web-master
./yii walle/setup # 需要输入yes
安装完成后会显示:
Migrated up successfully.
刷新页面看到50x或者404均是nginx配置不当,需要查看nginx日志
nginx简单配置
server { listen 80; server_name 192.168.3.13;# 改你的host root/data/www/walle-web/walle-web-master/web; # 根目录为web index index.php;
# 建议放内网
# 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;
}
}