初始网址一、背景1.1、由于百度首页最近添加网址,经常提示“系统升级中,暂不支持添加此网址。小度正在尽全力恢复服务,我们对此深感抱歉!”,百度公司估计瞧不上这点东东,反馈无门。咱也不敢说,咱也不敢问,咱不用了。1.2、从GitHub上找到WebStack-Guns,前台webstack,后台WebStack-Guns,准备开干。二、基本配置2.1、使用IDEA, 克隆代码 https://github.com/jsnjfz/WebStack-Guns.git2.2、修改application.yml文件。将网站图标上传目录file-upload-path,改为/opt/WebSiteNavigation/image。修改数据库URL,用户名,密码。url: jdbc:mysql://127.0.0.1:3306/guns?autoReconnect=true&useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=CONVERT_TO_NULL&useSSL=false&serverTimezone=CTT
username: root
password: *********
2.3、使用maven打包。在Maven Projects视图中,依次点击Webstack-Guns、Lifecycle、package,执行打包,生成target/Webstack-Guns-1.0.jar。2.4、连接远程MySql数据库,创建guns数据库。create database guns character set utf8mb4 collate utf8mb4_bin;2.5、执行guns.sql 文件,初始化数据库。2.6、上传jar包。上传Webstack-Guns-1.0.jar到服务器/opt/WebSiteNavigation目录。2.7、运行Webstack-Guns。切换目录,cd /opt/WebSiteNavigation
nohup java -jar Webstack-Guns-1.0.jar >/dev/null 2>&1&
#查询进程情况
ps -ef | grep Webstack
#杀进程
kill -9 pid
2.8、如果启动失败,使用java -jar Webstack-Guns-1.0.jar 命令启动,查看日志。三、高级配置-开机自启3.1、服务器/etc/systemd/system/目录新建Webstack-Guns.servicesudo vim /etc/systemd/system/Webstack-Guns.service复制粘贴以下内容, 注意要修改jar包路径。[Unit]
Description=Webstack-Guns Service
Documentation=https://jrcxsoft.com
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/java -server -Xms128m -Xmx256m -jar /opt/WebSiteNavigation/Webstack-Guns-1.0.jar
ExecStop=/bin/kill -s QUIT $MAINPID
Restart=always
[Install]
WantedBy=multi-user.target
3.2、启动Webstack-Guns# 修改 service 文件之后需要刷新 Systemd
sudo systemctl daemon-reload
# 使 Webstack-Guns 开机自启
sudo systemctl enable Webstack-Guns
# 启动 Webstack-Guns
sudo systemctl start Webstack-Guns 或者 sudo service Webstack-Guns start
# 重启 Webstack-Guns
sudo systemctl restart Webstack-Guns 或者 sudo service Webstack-Guns restart
# 停止 Webstack-Guns
sudo systemctl stop Webstack-Guns 或者 sudo service Webstack-Guns stop
# 查看 Webstack-Guns 的运行状态
sudo systemctl status Webstack-Guns 或者 sudo service Webstack-Guns status
四、高级配置-域名访问4.1、服务器/etc/nginx/conf.d/目录新建Webstack-Guns.conf文件sudo vim /etc/nginx/conf.d/Webstack-Guns.conf复制粘贴以下内容, 注意要修改域名,端口号等信息。server {
listen 80;
server_name hao.jrcxsoft.com;
location / {
proxy_set_header HOST $host;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://127.0.0.1:8000/;
}
}
4.2、检查配置是否有误,重载Nginx 配置。sudo nginx -t
sudo nginx -s reload
4.3、输入网址hao.jrcxsoft.com,可以看到系统默认网址。4.4、日常维护。输入http://hao.jrcxsoft.com/admin 进入控制台,默认密码admin 111111。可以增加、删除网址信息。
本文出自快速备案,转载时请注明出处及相应链接。