1、只支持pages仓库的main分支,对应域名为<用户名>.<domain>
2、暂不支持自动申请ssl证书
3、在main
分支根目录创建.spa
空白文件支持spa项目
1、下载gitea-pages-win.exe
3、双击运行gitea-pages-win.exe
4、修改生成的config.js
中的port: 8360
为port: process.env.ASPNETCORE_PORT
如:
// 生产环境使用
module.exports = {
// workers: 0, // 进程数(最大为cpu数,0为全部启用)
port: process.env.ASPNETCORE_PORT, // 服务器端口,默认 8360
// pages 服务器域名
pagesDomainName: 'localhost',
// gitea url 结尾不要 /
giteaUrl: 'https://gitea.com',
// user 白名单
whiteList: ['kongxiangyiren'],
// user 黑名单 如果whiteList配置了就失效
blackList: [],
// 缓存文件后缀名,如果匹配设置缓存30天
cacheSuffixName: /.(gif|png|jpe?g|css|js|woff|woff2|ttf|webp|ico)$/i,
// gzip
gzip: {
// gzip开关
enable: true,
// 要压缩的最小响应大小(以字节为单位)。默认为1024字节或1KB。
threshold: 1024
},
// gitee 文件树缓存 响应速度 (文件树缓存为10分钟,如果缓存文件404,将会刷新文件树)
cache: {
type: 'file', // redis 或者 file
// 文件缓存
file: {
gcInterval: 24 * 60 * 60 * 1000 // gc interval
},
// redis 缓存 配置
redis: {
port: 6379,
host: '127.0.0.1',
// username: "default", // needs Redis >= 6
password: '',
db: 0
}
}
};
5、自行修改config.js
的其他配置
6、创建web.config
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<location path="." inheritInChildApplications="false">
<system.webServer>
<handlers>
<add name="aspNetCore" path="*" verb="*" modules="AspNetCoreModuleV2" resourceType="Unspecified" />
</handlers>
<aspNetCore processPath=".\gitea-pages-win.exe" stdoutLogEnabled="true" stdoutLogFile=".\logs\stdout" hostingModel="outofprocess" />
</system.webServer>
</location>
</configuration>
1、下载gitea-pages-linux
2、运行gitea-pages-linux
./gitea-pages-linux
3、修改生成的config.js
4、 持久运行
nohup ./gitea-pages-linux &
5、 Nginx代理
#PROXY-START/
location ^~ /
{
proxy_pass http://127.0.0.1:8360/;
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;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_http_version 1.1;
proxy_set_header X-Forwarded-Proto $scheme;
# proxy_hide_header Upgrade;
add_header X-Cache $upstream_cache_status;
#Set Nginx Cache
set $static_gitea_pages 0;
if ( $uri ~* "\.(gif|png|jpg|css|js|woff|woff2)$" )
{
set $static_gitea_pages 1;
expires 1m;
}
if ( $static_gitea_pages = 0 )
{
add_header Cache-Control no-cache;
}
}
#PROXY-END/