正文
青春图床–开源图床源码young-pictures
青春图床–开源图床源码young-pictures
demo:http://yp.3yi.ink
github:https://github.com/lantongxue/young-pictures
主要技术
- 基于swoole的高性能框架 hyperf
- 分布式搜索引擎 Elasticsearch (这个还在研究中)
- MySQL数据库
- 渐进式前端框架 Vue.js
- redis做消费者队列
- 最新的php特性
运行环境
php版本:>= 7.4.0
其他依赖用composer安装会体现出来
运行步骤
git clone https://github.com/lantongxue/young-pictures.git
cd young-pictures
composer install -vvv
安装php依赖cd frontend
进入前端目录npm install
安装vue相关的依赖npm run build
生成dist文件夹,里面包含编译好的vuecd ../
返回到young-pictures目录下cp .env.example .env
并修改.env
里面的配置php bin/hyperf.php migrate
迁移数据库php bin/hyperf.php start
启动主程序
正常启动会监听9501端口,之后用nginx做一个反代就行了
贴一下我的nginx配置
server {
# 监听端口listen80;
# 绑定的域名,填写您的域名server_name yp.3yi.ink;
location/ {
root /var/www/young-pictures/frontend/dist/;
index index.html;
}
location ^~ /s/ {
# 将客户端的 Host 和 IP 信息一并转发到对应节点proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 转发Cookie,设置 SameSiteproxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
# 执行代理访问真实服务器proxy_pass http://127.0.0.1:9501;
}
location/browse {
# 将客户端的 Host 和 IP 信息一并转发到对应节点proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 转发Cookie,设置 SameSiteproxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
# 执行代理访问真实服务器proxy_pass http://127.0.0.1:9501;
}
location/upload {
# 将客户端的 Host 和 IP 信息一并转发到对应节点proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 转发Cookie,设置 SameSiteproxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
# 执行代理访问真实服务器proxy_pass http://127.0.0.1:9501;
}
location/test {
# 将客户端的 Host 和 IP 信息一并转发到对应节点proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
# 转发Cookie,设置 SameSiteproxy_cookie_path / "/; secure; HttpOnly; SameSite=strict";
# 执行代理访问真实服务器proxy_pass http://127.0.0.1:9501;
}
}