vicalloy / outline-docker-compose

Install a self-hosted Outline wiki instance in a couple of minutes
BSD 3-Clause "New" or "Revised" License
770 stars 132 forks source link

怎么配置config.sh能够使用域名访问 #13

Closed luchenqun closed 2 years ago

luchenqun commented 2 years ago

这是我的config.sh配置

# The url used to vist this web site.
URL=http://118.25.79.194:8888
# The default interface language. See translate.getoutline.com for a list of
# available language codes and their rough percentage translated.
DEFAULT_LANGUAGE=zh_CN
# https://docs.djangoproject.com/en/2.2/ref/settings/#language-code
LANGUAGE_CODE=en_US
# https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
TIME_ZONE=UTC
FORCE_HTTPS=false
# The domain in you email.
# Comma separated list of domains to be allowed (optional).
# If not set, the first user's domain is allowed by default.
ALLOWED_DOMAINS=

# Nginx
# The nginx bind ip and port.
# If you use ip address to access outline, this ip and port should be same as the URL.
# If this server behind a proxy(nginx), you can bind to `127.0.0.1`.
HTTP_IP=0.0.0.0
HTTP_PORT_IP=8888

# Docker
# If you server behind a proxy(nginx), and the proxy created by docker. You can use the proxy's network. Set the `NETWORKS` to proxy's network name, and set `NETWORKS_EXTERNAL` to `true` .
# The sample config for host nginx can be find in `config/sample/nginx_outline.conf`.
NETWORKS=outlinewiki
NETWORKS_EXTERNAL=false

# Secret keys, update by script.
# You shouldn't edit it.
MINIO_ACCESS_KEY=25cbd8fef14df517
MINIO_SECRET_KEY=e96cb9fe938768c87fcea1429198d94c38418ddf51770f518c88c786d8338135
OIDC_CLIENT_SECRET=e96cb9fe938768c87fcea1429198d94c38418ddf51770f518c88c786d8338135
OUTLINE_SECRET_KEY=8bba7dbc5cb45b7a0cd879b3c06ed17ff3b642be9fdea7db00bd0c2b9ecbd1e3
OUTLINE_UTILS_SECRET=68f6e7eb8cb84922de50ebe615de8463e90d35e3e104ce91765de533487e3ced
DJANGO_SECRET_KEY=b6f9599e3be93619f9caacf8f7090170ab7fc9de6f8b4ec7d56b6a2217ad2da0

为了我的域名能够访问,我在我机器上的nginx配置如下:

    server {
        listen 80;
        server_name wiki.lucq.fun;
        location / {
            proxy_pass http://127.0.0.1:8888;
            proxy_set_header Upgrade $http_upgrade;
            proxy_set_header Connection upgrade;
        }
    }

当我使用 http://wiki.lucq.fun 访问的时候,第一个页面能正常进入,当在第一个页面点击“使用openid继续”之后,他就跳转到了IP的网页。后续访问都是IP的网页。图片如下:

1 2 3

如果强制将IP访问的网页改为域名访问,比如将 http://118.25.79.194:8888/collection/welcome-Imb2SDo8P3 改为 http://wiki.lucq.fun/collection/welcome-Imb2SDo8P3 则又会跳转到认证页面。认证完成之后又会跳转到IP。

我也尝试过将config.sh 中的 URL=http://118.25.79.194:8888 改为 URL=http://wiki.lucq.fun ;但是认证却无法成功。

使用make logs查看日志,有如下关键警告日志: {"error":"State not return in OAuth flow","stack":"BadRequestError: State not return in OAuth flow\n at OAuthStateMismatchError (/opt/outline/build/server/errors.js:99:34)\n at StateStore.verify (/opt/outline/build/server/utils/passport.js:43:61)\n at OAuth2Strategy.authenticate (/opt/outline/node_modules/passport-oauth2/lib/strategy.js:222:26)\n at attempt (/opt/outline/node_modules/passport/lib/middleware/authenticate.js:366:16)\n at authenticate (/opt/outline/node_modules/passport/lib/middleware/authenticate.js:367:7)\n at /opt/outline/node_modules/@outlinewiki/koa-passport/lib/framework/koa.js:194:7\n at new Promise ()\n at /opt/outline/node_modules/@outlinewiki/koa-passport/lib/framework/koa.js:193:12\n at /opt/outline/node_modules/@outlinewiki/koa-passport/lib/framework/koa.js:143:7\n at new Promise ()\n at passportAuthenticate (/opt/outline/node_modules/@outlinewiki/koa-passport/lib/framework/koa.js:107:15)\n at passportMiddleware (/opt/outline/build/server/middlewares/passport.js:66:7)\n at dispatch (/opt/outline/node_modules/koa-compose/index.js:44:32)\n at next (/opt/outline/node_modules/koa-compose/index.js:45:18)\n at /opt/outline/node_modules/koa-router/lib/router.js:321:16\n at dispatch (/opt/outline/node_modules/koa-compose/index.js:44:32)\n at next (/opt/outline/node_modules/koa-compose/index.js:45:18)\n at methodOverrideMiddleware (/opt/outline/build/server/middlewares/methodOverride.js:22:12)\n at dispatch (/opt/outline/node_modules/koa-compose/index.js:44:32)\n at next (/opt/outline/node_modules/koa-compose/index.js:45:18)\n at /opt/outline/node_modules/koa-router/lib/router.js:321:16\n at dispatch (/opt/outline/node_modules/koa-compose/index.js:44:32)","level":"error","message":"Error during authentication"}

请问:如何配置config.sh我才能全程使用我的域名访问outline服务? 先谢谢你了,打扰你了!

luchenqun commented 2 years ago

问题已经解决了。谢谢了。

Zeqiang-Lai commented 2 years ago

我也遇到了同样的问题,可以问下你是怎么解决的吗

ouyanglong721 commented 1 year ago

问题已经解决了。谢谢了。

@luchenqun 你好,我遇到了相同的问题,无法绑定域名,请问你是怎么解决的呢。