搭建属于自己的网址导航网站
初始网址
一、背景
1.1、由于百度首页最近添加网址,经常提示“系统升级中,暂不支持添加此网址。小度正在尽全力恢复服务,我们对此深感抱歉!”,百度公司估计瞧不上这点东东,反馈无门。咱也不敢说,咱也不敢问,咱不用了。
1.2、从GitHub上找到WebStack-Guns,前台webstack,后台WebStack-Guns,准备开干。
二、基本配置
2.1、使用IDEA, 克隆代码 https://github.com/jsnjfz/WebStack-Guns.git
2.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=CTTusername: rootpassword: *********
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/WebSiteNavigationnohup 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.service
sudo vim /etc/systemd/system/Webstack-Guns.service
复制粘贴以下内容, 注意要修改jar包路径。
[Unit]Description=Webstack-Guns ServiceDocumentation=https://jrcxsoft.comAfter=network-online.targetWants=network-online.target[Service]Type=simpleExecStart=/usr/bin/java -server -Xms128m -Xmx256m -jar /opt/WebSiteNavigation/Webstack-Guns-1.0.jarExecStop=/bin/kill -s QUIT $MAINPIDRestart=always[Install]WantedBy=multi-user.target
3.2、启动Webstack-Guns
# 修改 service 文件之后需要刷新 Systemdsudo systemctl daemon-reload# 使 Webstack-Guns 开机自启sudo systemctl enable Webstack-Guns# 启动 Webstack-Gunssudo systemctl start Webstack-Guns 或者 sudo service Webstack-Guns start# 重启 Webstack-Gunssudo systemctl restart Webstack-Guns 或者 sudo service Webstack-Guns restart# 停止 Webstack-Gunssudo 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 -tsudo nginx -s reload
4.3、输入网址hao.jrcxsoft.com,可以看到系统默认网址。
4.4、日常维护。输入http://hao.jrcxsoft.com/admin 进入控制台,默认密码admin 111111。可以增加、删除网址信息。
本文来自作者:zx1080,不代表小新网立场!
转载请注明:https://www.xiaoxinys.cn/642689.html
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。