阿里云主机 ubutu 搭建 GHOST 并进行 nginx 反代

查看 34|回复 3
作者:chouxianyu   
1.更新Linux操作系统和软件包。
sudo apt-get update
sudo apt-get upgrade -y
2.安装 Nginx。
sudo apt-get install -y nginx
3.安装MySQL。
sudo apt-get install -y mysql-server
进入 MySQL:sudo mysql
创建数据库:CREATE DATABASE ghost_data;
设置root用户密码:ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password BY '12345678';
创建root用户:CREATE USER 'root'@'%' IDENTIFIED BY '12345678';
允许所有ip访问此数据库:GRANT ALL PRIVILEGES ON ghost_data.* TO 'root'@'%';
权限刷新:FLUSH PRIVILEGES;
4.MySQL安装node.js
curl -sL https://deb.nodesource.com/setup_18.x | sudo -E bash sudo apt-get install -y nodejs
5.安装 GHOST
拉取ghost镜像:docker pull ghost
创建目录:mkdir -p /data/ghost
创建容器:docker run -d \ --restart always \ --name ghost \ -p 2368:2368 \ -v /data/ghost:/var/lib/ghost/content \ -e NODE_ENV=development \ -e url=http://ip:2368 \ ghost
授权:chmod -R 777 /data/ghost/
重启容器:docker restart ghost
打开浏览器输入ip:2368,到此ghost搭建完成
6.nginx反代
切换路径:cd /etc/nginx/
编辑文件:vim nginx.conf
在http内加入这一段内容
server {
listen 80;
server_name chouxianyu.top;
       location / {
          proxy_pass   http://ip:2368;
          proxy_set_header Host $host;
          proxy_set_header X-Real-IP $remote_addr;
          proxy_set_header X-Forwarded-Proto $scheme;
          proxy_redirect off;
       }
   }
保存并退出后重启nginx:sudo systemctl restart nginx
打开浏览器输入域名,到此可以通过域名访问博客。
参考博客:http://chouxianyu.top/ubutu-da-jian-ghost/

阿里, 软件包

是否还能放弃   
啊,代{过}{滤}理有什么用呀
chouxianyu
OP
  

是否还能放弃 发表于 2024-9-8 20:32
啊,代{过}{滤}理有什么用呀

你需要通过域名访问你的博客就可以用代{过}{滤}理,不需要可以不改nginx.conf文件
yoyoma211   
进来学习一下,感谢分享
您需要登录后才可以回帖 登录 | 立即注册

返回顶部