1.下载git
我这里用的是 ubuntu系统,安装git
sudo apt-get install git
2.下载walle代码
git clone https://github.com/meolu/walle-web.git
3.安装mysql
sduo apt-get install mysql-server
启动mysql
service mysql start
查看是否启动mysqlps -ef|grep mysql
或者用sudo netstat -tap | grep mysql
4.安装nginx
sudo apt-get install nginx
5.配置nginx
在 /etc/nginx/conf.d目录下创建文件walle.conftouch walle.conf
,在 walle.conf添加如下代码:
upstream webservers {
server 0.0.0.0:5000 weight=1; # 负载设置
}
server {
listen 80;
server_name admin.walle-web.io; # 域名设置
access_log /usr/local/nginx/logs/walle.log main;
index index.html index.htm; # 日志目录
location / {
try_files $uri $uri/ /index.html;
add_header access-control-allow-origin *;
root /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";
}
}
其中有注释的都要根据自己的服务器进行修改。修改后重启nginxnginx -s reload
6.修改hosts
vi /etc/hosts
新增
127.0.0.1 admin.walle-web.io # 与nginx配置一致
7.安装
sh admin.sh init
如果出现not found错误,查看默认shls -al /bin/sh
,如果不是bash,请修改,sudo dpkg-reconfigure dash
如图:
选择No,然后执行sh admin.sh init
,
8.创建数据库
mysql -hxx -uxx -p -e'CREATE SCHEMA walle'
执行sh admin.sh migration
如果出现以下问题
说明 安装mysql的时候 因为没有设置密码,需要修改配置,详情可见https://www.cnblogs.com/cpl9412290130/p/9583868.html
这样就修改好了,接着执行sh admin.sh migration
9.启动
sh admin.sh start