- 目錄結構
- nginx配置:
- upstream bbs_upstream { server 127.0.0.1:1081; #php server 127.0.0.1:1086; #csharpe server 127.0.0.1:1087; #java server 127.0.0.1:1084; #ruby-sinatra server 127.0.0.1:1104; #ruby-busker server 127.0.0.1:1105; #ruby-ramaze server 127.0.0.1:1080; #nodejs-express server 127.0.0.1:1100; #nodejs-koa server 127.0.0.1:1101; #nodejs-hapi server 127.0.0.1:1102; #nodejs-restify server 127.0.0.1:1103; #nodejs-fastify server 127.0.0.1:1083; #python.cherrypy server 127.0.0.1:1088; #python.tornado server 127.0.0.1:1089; #python.flask server 127.0.0.1:1090; #python.fastapi server 127.0.0.1:1091; #python.bottle server 127.0.0.1:1092; #python.webpy server 127.0.0.1:1093; #python.pyramid server 127.0.0.1:1085; #go.gin server 127.0.0.1:1094; #go.iris server 127.0.0.1:1095; #go.echo server 127.0.0.1:1096; #go.beego server 127.0.0.1:1097; #go.chi server 127.0.0.1:1082; #perl.mojolicious server 127.0.0.1:1098; #perl.dancer server 127.0.0.1:1099; #perl.limper } server { listen 99; server_name localhost; location / { root D:/workspace/studys/study_bbs/static; index index.html index.htm postindex.html; autoindex on; autoindex_exact_size off; autoindex_localtime on; } location /api/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-Forwarded-Proto $scheme; proxy_pass_header Server; proxy_pass_header Date; proxy_pass_header X-Accel; proxy_pass http://bbs_upstream/; } }
- 啟動指令碼:
- @echo off echo Stopping nginx... taskkill /F /IM nginx.exe > nul echo Stopping c# study_bbs_csharpe.exe... taskkill /F /IM study_bbs_csharpe.exe > nul echo Starting java -jar study_bbs_java-0.0.1-SNAPSHOT.jar.. RunHiddenConsole java -jar D:\workspace\java_workspace\study_bbs_java\target\study_bbs_java-0.0.1-SNAPSHOT.jar cd D:\workspace\studys\study_bbs_csharpe\bin\Release\net8.0 RunHiddenConsole study_bbs_csharpe.exe cd D:\workspace\studys\study_bbs\ RunHiddenConsole D:\software\php-7.4.9\php.exe D:\workspace\studys\study_bbs\start_web_reactphp.php cd D:\workspace\studys\study_bbs\ RunHiddenConsole D:\software\Ruby27-x64\bin\ruby.exe D:\workspace\studys\study_bbs\start_web_sinatra.rb RunHiddenConsole D:\software\Ruby27-x64\bin\ruby.exe D:\workspace\studys\study_bbs\start_web_busker.rb RunHiddenConsole D:\software\Ruby27-x64\bin\ruby.exe D:\workspace\studys\study_bbs\start_web_ramaze.rb cd D:\workspace\studys\study_bbs\ RunHiddenConsole D:\software\Python310\python.exe D:\workspace\studys\study_bbs\start_web_cherrypy.py RunHiddenConsole D:\software\Python310\python.exe D:\workspace\studys\study_bbs\start_web_tornado.py RunHiddenConsole D:\software\Python310\python.exe D:\workspace\studys\study_bbs\start_web_flask.py RunHiddenConsole D:\software\Python310\python.exe D:\workspace\studys\study_bbs\start_web_fastapi.py RunHiddenConsole D:\software\Python310\python.exe D:\workspace\studys\study_bbs\start_web_bottle.py RunHiddenConsole D:\software\Python310\python.exe D:\workspace\studys\study_bbs\start_web_pyramid.py RunHiddenConsole D:\software\Python310\python.exe D:\workspace\studys\study_bbs\start_web_webpy.py 1092 cd D:\workspace\studys\study_bbs\ RunHiddenConsole D:\software\go\bin\go.exe run D:\workspace\studys\study_bbs\start_web_gin.go RunHiddenConsole D:\software\go\bin\go.exe run D:\workspace\studys\study_bbs\start_web_iris.go RunHiddenConsole D:\software\go\bin\go.exe run D:\workspace\studys\study_bbs\start_web_echo.go RunHiddenConsole D:\software\go\bin\go.exe run D:\workspace\studys\study_bbs\start_web_beego.go RunHiddenConsole D:\software\go\bin\go.exe run D:\workspace\studys\study_bbs\start_web_chi.go cd D:\workspace\studys\study_bbs\ RunHiddenConsole D:\software\Strawberry\perl\bin\perl.exe D:\workspace\studys\study_bbs\start_web_mojolicious.pl RunHiddenConsole D:\software\Strawberry\perl\bin\perl.exe D:\workspace\studys\study_bbs\start_web_dancer.pl RunHiddenConsole D:\software\Strawberry\perl\bin\perl.exe D:\workspace\studys\study_bbs\start_web_limper.pl cd D:\workspace\studys\study_bbs\ RunHiddenConsole D:\software\nodejs\node.exe D:\workspace\studys\study_bbs\start_web_express.js RunHiddenConsole D:\software\nodejs\node.exe D:\workspace\studys\study_bbs\start_web_koa.js RunHiddenConsole D:\software\nodejs\node.exe D:\workspace\studys\study_bbs\start_web_hapi.js RunHiddenConsole D:\software\nodejs\node.exe D:\workspace\studys\study_bbs\start_web_restify.js RunHiddenConsole D:\software\nodejs\node.exe D:\workspace\studys\study_bbs\start_web_fastify.js
- 建表sql:
- SET NAMES utf8mb4; SET FOREIGN_KEY_CHECKS = 0; CREATE TABLE `content` ( `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增編號', `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '標題', `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '內容', `userId` int(10) NOT NULL DEFAULT 0 COMMENT '發帖人id', `userNickename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '發帖人暱稱', `replyUserId` int(10) NOT NULL DEFAULT 0 COMMENT '最後回覆人id', `replyUserNickename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '最後回覆人暱稱', `replyNum` int(10) NOT NULL DEFAULT 0 COMMENT '回覆數', `viewNum` int(10) NOT NULL DEFAULT 0 COMMENT '瀏覽數', `isDel` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否刪除:0未刪,1已刪除', `addTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增時間', `updateTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新時間', PRIMARY KEY (`id`) USING BTREE, INDEX `isDel_updateTime`(`isDel`, `updateTime`) USING BTREE, INDEX `title`(`title`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 103 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '帖子表' ROW_FORMAT = Dynamic; CREATE TABLE `reply` ( `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增編號', `contentId` int(10) NOT NULL DEFAULT 0 COMMENT '帖子id', `content` text CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL COMMENT '內容', `replyUserId` int(10) NOT NULL DEFAULT 0 COMMENT '回覆人id', `replyUserNickename` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '回覆人暱稱', `isDel` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否刪除:0未刪,1已刪除', `addTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增時間', `updateTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新時間', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 156 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '回覆表' ROW_FORMAT = Dynamic; CREATE TABLE `user` ( `id` int(10) NOT NULL AUTO_INCREMENT COMMENT '自增編號', `username` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '使用者名稱', `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '密碼', `nickname` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '暱稱', `sessionId` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '會話id', `isDel` tinyint(1) NOT NULL DEFAULT 0 COMMENT '是否刪除:0未刪,1已刪除', `addTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) COMMENT '新增時間', `updateTime` timestamp(0) NOT NULL DEFAULT CURRENT_TIMESTAMP(0) ON UPDATE CURRENT_TIMESTAMP(0) COMMENT '更新時間', PRIMARY KEY (`id`) USING BTREE ) ENGINE = InnoDB AUTO_INCREMENT = 43 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '使用者表' ROW_FORMAT = Dynamic;
- 實際上,我是用幾乎所有開發語言做了一個學習,練習的小專案,實際效果: