在我的 gitea 服务器上,我通常通过 ssh 本地端口转发访问它;它不能从外部访问,因为我将它绑定(bind)到本地主机地址。
我从 http://127.0.0.1:8080
访问它通过“本地端口转发”,它认为它是从 http://127.0.0.1:3000
访问的;所以某些功能(wiki 中的预览和例如问题不起作用(但是你可以保存它们,只是不预览它们);无论如何它配置错误,见下文,我想更改 Gitea Base URL
所以当服务器当前写入 http://127.0.0.1:3000
时,它会改为写入 http://127.0.0.1:8080
(不过话说回来,如果它仍然在端口 3000
之外运行就更好了):
gitea.ini
在哪一行更改此功能?还是更像是我需要在它前面放置一个反向代理来为我重写 URL 的情况?
最佳答案
我没有纠结端口号,而是想更改域(localhost 到 foo)并找到 ROOT_URL
在 config cheat sheet 中提到:
ROOT_URL: %(PROTOCOL)s://%(DOMAIN)s:%(HTTP_PORT)s/: Overwrite the automatically generated public URL. This is useful if the internal and the external URL don’t match (e.g. in Docker).
还有一个 HTTP_PORT 选项也适用于您。
查看您的
/path/to/gitea/conf/app.ini
-> [server]
部分并相应更改[server]
APP_DATA_PATH = /path/to/gitea
DOMAIN = localhost
SSH_DOMAIN = localhost
HTTP_PORT = 3000
ROOT_URL = http://localhost:3000/
I'd like to change the Gitea Base URL so that anytime the server currently writes http://127.0.0.1:3000 it will write http://127.0.0.1:8080 instead (but that said, it would be good if it still operated off of port 3000):
我假设将 ROOT_URL 设置为
http://127.0.0.1:8080
但将 HTTP_PORT 保留为默认值 3000
应该这样做。
关于git - 通过SSH本地端口转发正常访问时指定gitea服务器Gitea Base URL?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/61647469/