搭建mix space博客 前端+后端

搭建mix space博客 前端+后端
前言
我是刚刚把博客从typecho转移到mix space的,中间遇到了许许多多的问题,想写这篇文章记录一下,也可以方便自己以后的查阅
感谢烧瑚烙饼在我搭建过程中帮我扫除了层层阻碍
需要准备的东西
- 一个灵活的脑子
- 一台linux服务器,服务器内存至少1GB(系统建议使用Ubuntu最新)
- 在服务器里安装好宝塔面板
- 两个域名(子域名也可以)+这两个域名的ssl证书
在宝塔面板的软件商店里面下载pm 2.0管理器
和Hgihx
,还需要安装Node 至少是16以上的版本
Ubuntu 安装依赖环境
sudo apt update && sudo apt install git curl vim wget git-lfs -y
安装依赖环境
依次运行下面两个指令
sudo su
npm install -g pnpm pm2
如果第二个指令下载过慢可以使用这个指令切换镜像源
npm config set registry http://mirrors.cloud.tencent.com/npm/
安装docker
sudo curl -fsSL https://get.docker.com | bash -s docker
国内服务器可以使用这个指令
sudo curl -fsSL https://get.docker.com | bash -s docker --mirror Aliyun
安装Docker-compose
下载 docker-compose
wget https://github.com/docker/compose/releases/download/v2.6.0/docker-compose-linux-x86_64
备用
wget https://download.fastgit.org/docker/compose/releases/download/v2.6.0/docker-compose-linux-x86_64
新建文件夹(非必须),可能需要
sudo mkdir -p /usr/local/lib/docker/cli-plugins/
复制到指定位置
sudo cp ./docker-compose-linux-x86_64 /usr/local/lib/docker/cli-plugins/docker-compose
赋予执行权限
sudo chmod +x /usr/local/lib/docker/cli-plugins/docker-compose
检查是否安装完成
docker compose version
正常输出版本号即可。
部署Core
cd
mkdir -p mx-space/server
cd mx-space/server
wget https://fastly.jsdelivr.net/gh/mx-space/core@master/docker-compose.yml
wget https://fastly.jsdelivr.net/gh/mx-space/core@master/.env.example -O .env
运行好后使用宝塔编辑 .env
文件 文件实例如下
1 | # SEE https://docs.docker.com/compose/environment-variables/#the-env-file |
拉取最新镜像
sudo docker compose pull
启动容器
sudo docker compose up -d
1 |
|
#PROXY-START/
location /socket.io {
proxy_http_version 1.1;
proxy_buffering off;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection “Upgrade”;
proxy_pass http://127.0.0.1:2333/socket.io;
}
location /
{
proxy_pass http://127.0.0.1:2333/;
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 REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
set $static_fileJsNv8TWb 0;
if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
{
set $static_fileJsNv8TWb 1;
expires 12h;
}
if ( $static_fileJsNv8TWb = 0 )
{
add_header Cache-Control no-cache;
}
}
#PROXY-END/
1 |
|
wget https://raw.githubusercontent.com/Innei/Shiro/main/docker-compose.yml
wget https://raw.githubusercontent.com/Innei/Shiro/main/.env.template .env
1 |
vim .env # 修改你的 ENV 变量
docker compose up -d
docker compose pull # 后续更新镜
1 |
|
rm -rf ./.env.template.1
mv ./.env.template .env
1 | 这个时候再刷新目录就会找到``.env``文件了。 |
{
“footer”: {
“otherInfo”: {
“date”: “2020-“,
“icp”: {
“text”: “萌 ICP 备 20236136 号”,
“link”: “https://icp.gov.moe/?keyword=20236136“
}
},
“linkSections”: [
{
“name”: “关于”,
“links”: [
{
“name”: “关于本站”,
“href”: “/about-site”
},
{
“name”: “关于我”,
“href”: “/about”
},
{
“name”: “关于此项目”,
“href”: “https://github.com/innei/Shiro“,
“external”: true
}
]
},
{
“name”: “更多”,
“links”: [
{
“name”: “时间线”,
“href”: “/timeline”
},
{
“name”: “友链”,
“href”: “/friends”
},
{
“name”: “监控”,
“href”: “https://status.innei.in/status/main“,
“external”: true
}
]
},
{
“name”: “联系”,
“links”: [
{
“name”: “写留言”,
“href”: “/message”
},
{
“name”: “发邮件”,
“href”: “mailto:i@innei.ren“,
“external”: true
},
{
“name”: “GitHub”,
“href”: “https://github.com/innei“,
“external”: true
}
]
}
]
},
“config”: {
“color”: {
“light”: [
“#33A6B8”,
“#FF6666”,
“#26A69A”,
“#fb7287”,
“#69a6cc”,
“#F11A7B”,
“#78C1F3”,
“#FF6666”,
“#7ACDF6”
],
“dark”: [
“#F596AA”,
“#A0A7D4”,
“#ff7b7b”,
“#99D8CF”,
“#838BC6”,
“#FFE5AD”,
“#9BE8D8”,
“#A1CCD1”,
“#EAAEBA”
]
},
"bg": [
"https://github.com/Innei/static/blob/master/images/F0q8mwwaIAEtird.jpeg?raw=true",
"https://github.com/Innei/static/blob/master/images/IMG_2111.jpeg.webp.jpg?raw=true"
],
"custom": {
"css": [],
"styles": [],
"js": [],
"scripts": []
},
"site": {
"favicon": "/innei.svg",
"faviconDark": "/innei-dark.svg"
},
"hero": {
"title": {
"template": [
{
"type": "h1",
"text": "Hi, I'm ",
"class": "font-light text-4xl"
},
{
"type": "h1",
"text": "Innei",
"class": "font-medium mx-2 text-4xl"
},
{
"type": "h1",
"text": "👋。",
"class": "font-light text-4xl"
},
{
"type": "br"
},
{
"type": "h1",
"text": "A NodeJS Full Stack ",
"class": "font-light text-4xl"
},
{
"type": "code",
"text": "<Developer />",
"class": "font-medium mx-2 text-3xl rounded p-1 bg-gray-200 dark:bg-gray-800/0 hover:dark:bg-gray-800/100 bg-opacity-0 hover:bg-opacity-100 transition-background duration-200"
},
{
"type": "span",
"class": "inline-block w-[1px] h-8 -bottom-2 relative bg-gray-800/80 dark:bg-gray-200/80 opacity-0 group-hover:opacity-100 transition-opacity duration-200 group-hover:animation-blink"
}
]
},
"description": "An independent developer coding with love."
},
"module": {
"activity": {
"enable": true,
"endpoint": "/fn/ps/update"
},
"donate": {
"enable": true,
"link": "https://afdian.net/@Innei",
"qrcode": [
"https://cdn.jsdelivr.net/gh/Innei/img-bed@master/20191211132347.png",
"https://cdn.innei.ren/bed/2023/0424213144.png"
]
},
"bilibili": {
"liveId": 1434499
}
}
}
}
1 | 然后点击右上角的保存 |
server{
location ~* .(gif|png|jpg|css|js|woff|woff2)$ {
proxy_pass http://127.0.0.1:2323;
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 REMOTE-HOST $remote_addr;
expires 30d;
}
location ~* /(feed|sitemap|atom.xml) {
proxy_pass http://127.0.0.1:2333/$1;
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 REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
add_header Cache-Control max-age=60;
}
location / {
proxy_pass http://127.0.0.1:2323;
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 REMOTE-HOST $remote_addr;
add_header X-Cache $upstream_cache_status;
add_header Cache-Control no-cache;
proxy_intercept_errors on;
}
}
把这个复制到配置文件里之后就配置好了
现在你就可以访问你的网页了
- Title: 搭建mix space博客 前端+后端
- Author: ZXEB
- Created at : 2025-02-11 22:40:15
- Updated at : 2025-02-12 07:57:11
- Link: https://blog.xp6.top//posts/云服务器/mix-space
- License: This work is licensed under CC BY-NC-SA 4.0.