【推荐】2019 Java 开发者跳槽指南.pdf(吐血整理) >>>
一、环境安装
VMware Workstation,centos7.6 64位,lnmp1.5
二、安装lnmp1.5
wget http://soft.vpser.net/lnmp/lnmp1.5.tar.gz -cO lnmp1.5.tar.gz && tar zxf lnmp1.5.tar.gz && cd lnmp1.5 && ./install.sh lnmp
注意:MySQL 5.6.5以上,否则会在安装时报错。在MySQL 5.6.5版本之前,Automatic Initialization and Updating只适用于TIMESTAMP,而且一张表中,最多允许一个TIMESTAMP字段采用该特性。从MySQL 5.6.5开始,Automatic Initialization and Updating同时适用于TIMESTAMP和DATETIME,且不限制数量。
三、nginx配置
user www www;
worker_processes auto;
error_log /home/wwwlogs/nginx_error.log crit;
pid /usr/local/nginx/logs/nginx.pid;
#Specifies the value for maximum file descriptors that can be opened by this process.
worker_rlimit_nofile 51200;
events {
use epoll;
worker_connections 51200;
multi_accept on;
}
http {
include mime.types;
default_type application/octet-stream;
server_names_hash_bucket_size 128;
client_header_buffer_size 32k;
large_client_header_buffers 4 32k;
client_max_body_size 50m;
sendfile on;
tcp_nopush on;
keepalive_timeout 60;
tcp_nodelay on;
fastcgi_connect_timeout 300;
fastcgi_send_timeout 300;
fastcgi_read_timeout 300;
fastcgi_buffer_size 64k;
fastcgi_buffers 4 64k;
fastcgi_busy_buffers_size 128k;
fastcgi_temp_file_write_size 256k;
gzip on;
gzip_min_length 1k;
gzip_buffers 4 16k;
gzip_http_version 1.1;
gzip_comp_level 2;
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml application/xml+rss;
gzip_vary on;
gzip_proxied expired no-cache no-store private auth;
gzip_disable "MSIE [1-6]\.";
#limit_conn_zone $binary_remote_addr zone=perip:10m;
##If enable limit_conn_zone,add "limit_conn perip 10;" to server section.
server_tokens off;
access_log off;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
upstream webservers {
server 0.0.0.0:5000 weight=1; # 负载设置
}
server {
listen 80;
server_name localhost; # 域名设置
access_log /home/wwwlogs/walle.log main;
index index.html index.htm; # 日志目录
location / {
try_files $uri $uri/ /index.html;
add_header access-control-allow-origin *;
root /home/wwwroot/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";
}
}
include vhost/*.conf;
}
注意:
nginx重启时,报错invalid PID number
/etc/init.d/nginx reload
Reload service nginx... nginx: [error] invalid PID number "" in "/usr/local/nginx/logs/nginx.pid"
问题定位:安装nginx时,未生成/usr/local/nginx/logs/nginx.pid
解决方法:手动生成/usr/local/nginx/logs/nginx.pid,
找到nginx:master的pid号,30784,写入/usr/local/nginx/logs/nginx.pid,再次重启nginx,成功
四、安装
1、安装walle-web
cd /home/wwwroot
git clone https://github.com/meolu/walle-web.git
2、安装Python 2.7+ pip
sh admin.sh init
# 注意:安装mysqlclient失败,需要先安装libmysqlclient-dev(ubuntu)
# 注意:安装失败请指定python路径. mac 可能会有用anaconda的python,找到自己系统的python 2.7追加参数指定 -p /usr/bin/python2.7 即可
# vi admin.sh +20
# virtualenv --no-site-packages -p /usr/local/bin/python2.7 venv
3、配置
vi walle/config/settings_prod.py
注:需要更改域名和数据库连接参数
4、数据迁移
1) 创建一个数据库 walle
mysql -hxx -uxx -p -e'CREATE SCHEMA walle'
2) Data Migration
sh admin.sh migration
注:报错 Can`t connet to local MYSQL server through socket
分析原因:缺少/var/lib/mysql/mysql.sock
解决方法:可将mysql.sock做一个软连接,比如mysql.sock文件在/tmp/mysql.sock,则执行ln -s /tmp/mysql.sock /var/lib/mysql/mysql.sock 即可
5、启动
1) 启动
sh admin.sh start
2) 重启、升级、迁移
sh admin.sh restart # 重启
sh admin.sh upgrade # 升级walle,升级完需要重启walle服务。升级前最好 git stash 暂存本地修改,升级后git stash pop弹出暂存,然后重启服务。
sh admin.sh migration # Migration
五、开启walle 2.0之旅
恭喜你,大功告成!浏览器打开http://192.168.111.128(因nginx配置域名而定,我配置的域名是localhost,所以直接IP访问)。初始登录账号如下,开启你的walle 2.0之旅吧:)
超管:super@walle-web.io \ Walle123
所有者:owner@walle-web.io \ Walle123
负责人:master@walle-web.io \ Walle123
开发者:developer@walle-web.io \ Walle123
访客:reporter@walle-web.io \ Walle123
六、其它
walle运行过程,以及部署过程出错了,具体日志可以查看logs/runtime.log
,别说你在启动walle的时候没注意到?
如果出现任何打开页面出现404或者只显示’wall-web 2.0’等,都是nginx配置或者服务没有启动,细心检查。
来源:oschina
链接:https://my.oschina.net/u/1422143/blog/3040503