实验系统:CentOS 7
实验前提:防火墙和selinux都关闭
实验说明:本实验共有1台主机,IP分配192.168.0.210
实验软件:walle-web-0.9.5 httpd-2.2 mysql-5.5 php-7.0.30
一、基础准备
1.下载walle-web源码:
mkdir
-pv /wallecd /walle
wget
https:
//codeload.github.com/meolu/walle-web/tar.gz/v0.9.5
tar
xf v0.
9.5
mv
walle-web-
0.9
.
5
walle-web
cd
2.安装LAMP环境:
yum
-y
install
nginx php php-mysql php-mbstring mysql-server
service httpd start
service mysqld start
3.加入php页面支持:
vim /etc/httpd/conf/httpd.conf--------------------------------------------->DirectoryIndex index.php index.html index.html.var
//增加index.php
4.mysql创建数据库并修改root密码:
mysql--------------------------------------------->CREATE DATABASE walle;UPDATE mysql.user SET Password=PASSWORD(
123456
) WHERE User=
'root'
;FLUSH PRIVILEGES;
quit
二、安装walle-web
1.修改配置文件,连接数据库:
vim /data/www/walle-web/config/local.php--------------------------------------------->
'db'
=> [
'dsn'
=>
'mysql:host=127.0.0.1;dbname=walle'
,
//数据库地址与库名称
'username'
=>
'root'
,
//连接数据库用户
'password'
=>
'123456'
,
//用户密码
],
2.安装composer:
curl -sS https:
//getcomposer.org/installer | php
mv
composer.phar /usr/local/bin/composer
3.安装vendor:
tar
xf vendor.tgz
mv
vendor /data/www/walle-web/
4.初始化项目:
cd /data/www/walle-web/./yii run/setup
//需要回答yes
三、最后的配置
1.配置nginx的虚拟主机:
server {
listen 80;
server_name 192.168.0.211;
root /walle/walle-web/web;
index index.html 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_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
2.使用浏览器访问http://192.168.0.210测试,用户名和密码均为admin:
至此,服务器搭建完毕,感谢观看,谢谢!