安装tomcat
略
安装数据库
略
如果你想用域名打开你的网站,需要安装nginx
略
重点来了(由于我不会打war包,咋们还是直接下载现成的吧)
下载源码包(里面就有tomcat需要的war文件)
wget https://github.com/JpressProjects/jpress/archive/0.4.0.tar.gz
解压
tar xf 0.4.0.tar.gz
将解压后的站点目录搬家到tomcat 的webapps目录下面(我的是在/use/local/tomcat/webapps)
mv jpress-0.4.0/wars/jpress-web-newest.war /use/local/tomcat/webapps/
每次上线更新war包可能都需要重新启动tomcat
关闭
cd /usr/local/tomcat/bin
./shutdown.sh
开启
./startup.sh
检验端口是否正确打开(端口可在配置文件更改,我相信你们都会改,我的是8888)
netstat -lntup
网页端查看
地址栏 (ip+端口)
输入 ip+8888
一旦执行完上面这个操作,tomcat会自动把这个war包(jpress-web-newest.war)解压了
此时webapps目录下应该是这样
[root@pa1 webapps]#ll
total 20304
drwxr-xr-x 14 root root 4096 Nov 27 13:31 docs
drwxr-xr-x 6 root root 4096 Nov 27 13:31 examples
drwxr-xr-x 5 root root 4096 Nov 27 13:31 host-manager
drwxr-x--- 8 root root 4096 Jan 19 14:54 jpress-web-newest
-rw-rw-r-- 1 root root 20764271 Sep 19 2016 jpress-web-newest.war
drwxr-xr-x 5 root root 4096 Nov 27 13:31 manager
drwxr-xr-x 3 root root 4096 Nov 27 13:31 ROOT
然后开始网页端初始化(注意我的端口是8888,看到这里请把下一步也看完)
地址栏输入 ip:8888/jpress-web-newest
如若上一步操作完了在网页端看到初始化界面,停下来,该操作mysql了,创建一个库,叫jpress,我知道你们都知道这是干嘛的
mysql -uroot -p
create database jpress;
开始初始化配置了,没截图,看你们悟性了,如有问题,联系下方扣扣
jpress的后台地址是ip:8888/jpress-web-newest/admin/login
这里贴出我的nginx配置文件,以资后辈参考(各位注意排版哦)
#user nobody;
worker_processes 1;
error_log /var/log/nginx/error.log;
pid /usr/local/nginx/nginx.pid;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
access_log /var/log/nginx/access.log ;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name yimiyuntong.com;
add_header X-Frame-Options SAMEORIGIN;
location / {
proxy_pass http://localhost:8888;
proxy_redirect off;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $host;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504 http_404;
client_max_body_size 1000m;
client_body_buffer_size 128k;
proxy_connect_timeout 18000;
proxy_send_timeout 18000;
proxy_read_timeout 18000;
proxy_cache_valid 200 302 12h;
proxy_cache_valid 301 1d;
proxy_cache_valid any 1h;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
}