독립 설치 시 발생하는 문제 및 별도 IP 주소 사용 방법

다른 Nginx 사이트와 함께 Discourse를 설치하는 방법을 알아보고 있었는데, 설정 시 계속해서 다음과 같은 메시지가 표시됩니다:

WARNING: Port 443 of computer does not appear to be accessible using hostname:  lush.gg.
WARNING: Connection to http://<domain> (port 80) also fails.

Cloudflare가 IP 주소를 프록시하지 않도록 확인했습니다. 또한 서버에 연결된 보조 IP 주소를 사용 중이며, 첫 번째 IP 주소에는 이미 Nginx 웹사이트가 있습니다.

app.yml 업데이트

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
  - "templates/web.socketed.template.yml"
## Uncomment these two lines if you wish to add Lets Encrypt (https)
#- "templates/web.ssl.template.yml"
#- "templates/web.letsencrypt.ssl.template.yml"

## which TCP/IP ports should this container expose?
## If you want Discourse to share a port with another webserver like Apache or nginx,
## see https://meta.discourse.org/t/17247 for details
#expose:
#- "25654:80" # http
#- "443:443" # https

nginx conf 업데이트

server {
    listen <ip address>:80; listen [::]:80;
    server_name <domain>;  # <-- change this

    return 301 https://$host$request_uri;
}

server {
    listen <ip address>:443 ssl http2;  listen [::]:443 ssl http2;
    server_name <domain>;  # <-- change this

    ssl_certificate /data/web/discourse/shared/standalone/ssl/fullchain.pem;
    ssl_certificate_key /data/web/discourse/shared/standalone/ssl/privkey.pem;
    ssl_dhparam          /data/web/discourse/shared/standalone/ssl/dhparams.pem;
    ssl_session_tickets off;
    # removed from post: ssl_ciphers ...

    http2_idle_timeout 5m; # up from 3m default
    client_max_body_size 0;

    location / {
        proxy_pass http://unix:/data/web/discourse/shared/standalone/nginx.http.sock:;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

제가 무엇을 잘못하고 있는 걸까요?

서버의 포트 80/443이 다른 nginx 서버에 의해 사용 중이므로 Discourse가 연결을 설정할 수 없습니다.

같은 서버에서 Discourse와 다른 웹사이트를 함께 실행하려면 다음 튜토리얼을 사용하세요:

네, 사실 처음에 이 방법을 먼저 시도해 봤어요. 하지만 다시 한번 시도해서 어떻게 됐는지 알려드릴게요!

불행히도 같은 문제입니다!

nginx conf

server {
    listen 80; listen [::]:80;
    server_name lush.gg;  # <-- 이 부분을 변경하세요

    return 301 https://$host$request_uri;
}

server {
    listen 443 ssl http2;  listen [::]:443 ssl http2;
    server_name lush.gg;  # <-- 이 부분을 변경하세요

    ssl_certificate /etc/letsencrypt/live/lush.gg/fullchain.pem;
    ssl_certificate_key /etc/letsencrypt/live/lush.gg/privkey.pem;
#    ssl_dhparam          /var/discourse/shared/standalone/ssl/dhparams.pem;
    ssl_session_tickets off;
    ssl_ciphers ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:DHE-RSA-AES128-GCM-SHA256:DHE-DSS-AES128-GCM-SHA256:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-DSS-AES128-SHA256:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:DHE-RSA-AES256-SHA:ECDHE-RSA-DES-CBC3-SHA:ECDHE-ECDSA-DES-CBC3-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:AES128-SHA256:AES256-SHA256:AES128-SHA:AES256-SHA:AES:CAMELLIA:DES-CBC3-SHA:!aNULL:!eNULL:!EXPORT:!DES:!RC4:!MD5:!PSK:!aECDH:!EDH-DSS-DES-CBC3-SHA:!EDH-RSA-DES-CBC3-SHA:!KRB5-DES-CBC3-SHA;

    http2_idle_timeout 5m; # 기본값 3m에서 5m로 증가
    client_max_body_size 0;

    location / {
        proxy_pass http://unix:/data/web/lush-discourse/shared/standalone/nginx.http.sock:;
        proxy_set_header Host $http_host;
        proxy_http_version 1.1;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto https;
        proxy_set_header X-Real-IP $remote_addr;
    }
}

app.yml

templates:
  - "templates/postgres.template.yml"
  - "templates/redis.template.yml"
  - "templates/web.template.yml"
  - "templates/web.ratelimited.template.yml"
  - "templates/web.socketed.template.yml"
## Lets Encrypt(https)를 추가하려면 아래 두 줄의 주석을 해제하세요
#- "templates/web.ssl.template.yml"
#- "templates/web.letsencrypt.ssl.template.yml"

## 이 컨테이너가 노출해야 하는 TCP/IP 포트는 무엇인가요?
## Apache나 nginx와 같은 다른 웹서버와 Discourse가 포트를 공유하려면
## 자세한 내용은 https://meta.discourse.org/t/17247 를 참조하세요
#expose:
#- "25654:80" # http
#- "443:443" # https

알겠습니다! 핵심은 DOCKER_USE_HOSTNAME: true를 활성화하는 것이었습니다.