第一章 walle搭建部署
环境: centos 5.6
1. 首先安装nginx (这里就不写安装过程了,百度搜吧)
2. 安装mysql
创建数据库walle
3. 安装php5.4版本以上
卸载旧版本5.3.8 php
yum remove php php-bcmath php-cli php-common php-devel php-fpm php-gd php-imap php-ldap php-mbstring php-mcrypt php-mysql php-odbc php-pdo php-pear php-pecl-igbinary php-xml php-xmlrpc
更新源
rpm -Uvh http://mirror.webtatic.com/yum/el6/latest.rpm
安装新版本5.5php
yum -y install php55w php55w-bcmath php55w-cli php55w-common php55w-devel php55w-fpm php55w-gd php55w-imap php55w-ldap php55w-mbstring php55w-mcrypt php55w-mysql php55w-odbc php55w-pdo php55w-pear php55w-pecl-igbinary php55w-xml php55w-xmlrpc php55w-opcache php55w-intl php55w-pecl-memcache
4. 下载walle包 (这里我放在我云盘了,避免以后数据地址又找不到)
下载链接: https://yunpan.cn/c6dNYstqBTPRa 分享码: d99d
5. 设置数据库连接, smtp发送邮件连接
vi config/local.php +14 'db' => [
'dsn' => isset($_ENV['WALLE_DB_DSN']) ? $_ENV['WALLE_DB_DSN'] : 'mysql:host=127.0.0.1;dbname=walle',
'username' => isset($_ENV['WALLE_DB_USER']) ? $_ENV['WALLE_DB_USER'] : 'root',
'password' => isset($_ENV['WALLE_DB_PASS']) ? $_ENV['WALLE_DB_PASS'] : '数据库密码',
], |
'mail' => [
'transport' => [
'host' => isset($_ENV['WALLE_MAIL_HOST']) ? $_ENV['WALLE_MAIL_HOST'] : 'smtp.exmail.qq.com', # smtp 发件地址
'username' => isset($_ENV['WALLE_MAIL_USER']) ? $_ENV['WALLE_MAIL_USER'] : '
[email protected]', # smtp 发件用户名
'password' => isset($_ENV['WALLE_MAIL_PASS']) ? $_ENV['WALLE_MAIL_PASS'] : 'xxxxxxxx', # smtp 发件人的密码
'port' => isset($_ENV['WALLE_MAIL_PORT']) ? $_ENV['WALLE_MAIL_PORT'] : 25, # smtp 端口
'encryption' => isset($_ENV['WALLE_MAIL_ENCRYPTION']) ? $_ENV['WALLE_MAIL_ENCRYPTION'] : 'tls', # smtp 协议
],
6.
安装composer,如果已安装跳过
curl -sS https://getcomposer.org/installer | php mv composer.phar /usr/local/bin/composer # PATH目录
|
注: 为了保证链接以后失效。我传到网盘啦。 地址https://yunpan.cn/c6didZ64eK3Fn 分享码: 65de 7.
安装vendor
cd walle-web composer install --prefer-dist --no-dev --optimize-autoloader -vvvv
|
可能安装不成功。没关系,你直接下载vendor 解压到walle-web目录下 (对了我上面walle-web的项目里面已经包含vendor了,你可以不用再安装)。
8. 初始化项目
cd walle-web ./yii walle/setup # 需要你的yes
|
9. nginx配置
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
server
{
listen 80;
server_name 192.168.1.36;
root /root/test/walle-web/web;
index index.php;
location / {
try_files $uri $uri/ /index.php$is_args$args;
}
location ~ .*\.php?$
{
try_files $uri = 404;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass localhost:8000;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
include fastcgi.conf;
include fastcgi_params;
}
}
}
注: 对了你要启动php-fpm, php-cgi额。 启动方法
# service php-fpm start
# /usr/bin/php-cgi -b 127.0.0.1:8000 -c /etc/php.ini
另外保证/etc目录下存在/etc/php-fpm.conf. 默认路径你可以find / -name php-fpm.conf找下,再copy也行。下面是我系统的。[root@WebServer config]# cat /etc/php-fpm.conf
;;;;;;;;;;;;;;;;;;;;;
; FPM Configuration ;
;;;;;;;;;;;;;;;;;;;;;
; All relative paths in this configuration file are relative to PHP's install
; prefix.
; Include one or more files. If glob(3) exists, it is used to include a bunch of
; files from a glob(3) pattern. This directive can be used everywhere in the
; file.
include=/etc/php-fpm.d/*.conf
;;;;;;;;;;;;;;;;;;
; Global Options ;
;;;;;;;;;;;;;;;;;;
[global]
; Pid file
; Default Value: none
pid = /var/run/php-fpm/php-fpm.pid
; Error log file
; Default Value: /var/log/php-fpm.log
error_log = /var/log/php-fpm/error.log
; Log level
; Possible Values: alert, error, warning, notice, debug
; Default Value: notice
;log_level = notice
; If this number of child processes exit with SIGSEGV or SIGBUS within the time
; interval set by emergency_restart_interval then FPM will restart. A value
; of '0' means 'Off'.
; Default Value: 0
;emergency_restart_threshold = 0
; Interval of time used by emergency_restart_interval to determine when
; a graceful restart will be initiated. This can be useful to work around
; accidental corruptions in an accelerator's shared memory.
; Available Units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;emergency_restart_interval = 0
; Time limit for child processes to wait for a reaction on signals from master.
; Available units: s(econds), m(inutes), h(ours), or d(ays)
; Default Unit: seconds
; Default Value: 0
;process_control_timeout = 0
; Send FPM to background. Set to 'no' to keep FPM in foreground for debugging.
; Default Value: yes
daemonize = yes
;;;;;;;;;;;;;;;;;;;;
; Pool Definitions ;
;;;;;;;;;;;;;;;;;;;;
; See /etc/php-fpm.d/*.conf
好啦。 启动nginx服务吧。 访问http://ip
默认用户名为admin 密码admin.
接下来就是把项目和walle 结合起来。下一章节继续。