Centos7 安装并配置walle
官方地址 https://github.com/meolu/walle-web/
1 安装mysql
过程(暂时略)
在数据库中创建walle 库
create database walle charset=utf8 collate utf8_general_ci;
2 安装php
查看是否安装php
rpm -qa |grep php
rpm -e 包名
也可以省事 直接全部删除
yum -y remove php*
yum安装依赖
yum install -y 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
查看安装的php 版本
如果版本地域5.5 需要更新至5.5或以上 否则编译会报错
更新源
rpm -Uvh https://mirror.webtatic.com/yum/el7/epel-release.rpm
rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm
yum -y remove php-common
yum -y install -y php56w php56w-opcache php56w-xml php56w-mcrypt
yum -y php56w-gd php56w-devel php56w-mysql php56w-intl php56w-mbstring
3 安装git和svn
yum -y install git
yum -y install svn
下载源码
cd /data
wget https://github.com/meolu/walle-web/archive/master.zip
unzip walle-web-master.zip
mv walle-web-master walle-web
4 安装mailx
yum install mailx
配置mailx
配置修改/etc/mail.rc配置文件(如果mail.rc不存在,则编辑/etc/mail.rc)。
在/etc/mail.rc文件末尾添加如下内容:
set from="your name"
set smtp=smtp.163.com
set smtp-auth-user=mailname@163.com
set smtp-auth-password=password
set smtp-auth=login
注:使用前需打开邮箱的SMTP功能,一般在邮箱的设置里面。
使用mailx发送邮件
-s subject 邮件标题
-a file 添加附件
-v 显示邮件发送详细过程
-V 显示mail(mailx)版本信息
邮件内容可来源于管道、输入重定向等,例如:
mailx -s "发件人名称 邮件标题" mailname@163.com < message.txt
cat message | mailx -s "发件人名称 邮件标题" mailname@163.com
echo "mail test message" | mailx -v -s " title" mailnamexxx3@163.com
也可以直接从命令行输入邮件内容:
mailx -s "发件人名称 邮件标题" mailname@163.com ##输入完后回车按Ctrl+D提交发送
多个收件人之间用逗号分隔:
cat message | mailx -s "发件人名称 邮件标题" mail1@163.com, mail2@163.com, mail3@163.com
5 安装nginx(此处我安装的是openresty,由于以前有安装过,此处略过如何安装,以前有发布如何安装openresty)
nginx配置如下:
user root;
worker_processes 2;
worker_priority -15; #woker进程优先级-20~19
worker_cpu_affinity auto; #自动绑定cpu跟进程的关系
worker_rlimit_nofile 65535;#理论上这个值是最多打开文件数(ulimit -n)与nginx工作进程相除
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid;
events {
worker_connections 20480;#单个进程允许的客户端最大连接数
}
http {
include mime.types;
default_type application/octet-stream;
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
gzip_comp_level 6;
gzip_types text/css;
gzip_http_version 1.1;
gzip_min_length 1024;
gzip_disable "MSIE [1-6]\.";
directio 100m;
aio threads=default;
upstream webservers{
server 0.0.0.0:5000 weight=1;#负载设置
}
server {
listen 80;
server_name localhost;
access_log /usr/local/openresty/nginx/logs/walle.log;
index index.html index.htm; # 日志目录
rewrite_log on;#行为日志
root /var/www/html;
location / {
limit_req zone=test burst=5 nodelay;
index index.php index.html index.htm;
try_files $uri $uri/ /index.html;
add_header access-control-allow-origin *;
root /data/walle-web/fe; # 前端代码已集成到walle-web,即walle-web/fe的绝对路径
}
location ^~ /api/ {
add_header access-control-allow-origin *;
proxy_pass http://webservers;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Origin $host:$server_port;
proxy_set_header Referer $host:$server_port;
}
location ^~ /socket.io/ {
add_header access-control-allow-origin *;
proxy_pass http://webservers;
proxy_set_header X-Forwarded-Host $host:$server_port;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Origin $host:$server_port;
proxy_set_header Referer $host:$server_port;
proxy_set_header Host $http_host;
proxy_set_header X-NginX-Proxy true;
# WebScoket Support
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
location ~ \.php$ {
fastcgi_pass 114.67.105.89:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; #加了这一项
include fastcgi_params;
}
}
}
配置完后重启nginx :
openresty -s reload
整个项目都是通过admin.sh,来启动的,主要有下面两个(暂时不执行)。
sh admin.sh start #启动walle端口服务
sh admin.sh migration #加载数据库,创建表与添加数据