나는 Drupal 7 기반의 PHP Generic과 Varnish를 사용하는 3개의 사이트를 운영하고 있습니다. LEMP 스택은 NGINX를 사용하고 있습니다.
이 중 하나의 사이트에 Discourse를 포럼으로 설치하고 싶습니다.
Docker와 Discourse를 설치하고, 서브도메인 및 /etc/nginx/sites-enabled/forum.linguagemclipper.com.br.conf 파일을 설정했으며, 인증서도 생성했습니다.
설치 후 다음과 같은 오류가 발생합니다: “The provided host name is not valid for this server.”
같은 포트 사용과 관련된 여러 오류가 발생했습니다.
제 .conf 파일과 app.yml 파일에 문제가 있는 것 같습니다. ChatGPT의 도움을 받아 여러 테스트를 해보았으며, ./discourse-doctor 명령어도 실행해 보았지만 더 이상 어떻게 해야 할지 모르겠습니다…
제 .conf 파일:
server {
listen 80;
listen [::]:80;
server_name forum.linguagemclipper.com.br;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
listen [::]:443 ssl;
http2 on;
http3 off;
server_name forum.linguagemclipper.com.br;
ssl_certificate /etc/letsencrypt/live/forum.linguagemclipper.com.br/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/forum.linguagemclipper.com.br/privkey.pem;
ssl_protocols TLSv1.2 TLSv1.3;
ssl_ciphers HIGH:!aNULL:!MD5;
location / {
proxy_pass http://127.0.0.1:8080;
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 X-Forwarded-Proto https;
}
}
제 app.yml 파일:
templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
## IPv6 리스너를 활성화하려면 다음 줄의 주석을 해제하세요
#- "templates/web.ipv6.template.yml"
- "templates/web.ratelimited.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:
- "8080:80" # Discourse 내부 http를 포트 8080으로 매핑
# - "3000:80" # http
# - "4433:443" # https
params:
db_default_text_search_config: "pg_catalog.english"
## db_shared_buffers를 총 메모리의 최대 25%로 설정하세요.
## bootstrap이 감지된 RAM에 따라 자동으로 설정되거나, 직접 오버라이드할 수 있습니다
db_shared_buffers: "2048MB"
## 정렬 성능을 향상시킬 수 있지만 연결당 메모리 사용량이 증가합니다
db_work_mem: "40MB"
## 이 컨테이너가 사용할 Git 리비전은 무엇입니까? (기본값: tests-passed)
#version: tests-passed
env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LANGUAGE: en_US.UTF-8
DISCOURSE_DEFAULT_LOCALE: pt_BR
# 내부 SSL을 사용하지 않아도 HTTPS가 강제됩니다
DISCOURSE_FORCE_HTTPS: true
## 동시 웹 요청을 몇 개까지 지원할 수 있습니까? 메모리와 CPU 코어 수에 따라 달라집니다.
## bootstrap이 감지된 CPU에 따라 자동으로 설정되거나, 직접 오버라이드할 수 있습니다
UNICORN_WORKERS: 4
일부 오류 메시지:
+ /usr/bin/docker run --shm-size=512m -d --restart=always -e LANG=en_US.UTF-8 -e RAILS_ENV=production -e UNICORN_WORKERS=4 -e UNICORN_SIDEKIQS=1 -e RUBY_GC_HEAP_GROWTH_MAX_SLOTS=40000 -e RUBY_GC_HEAP_INIT_SLOTS=400000 -e RUBY_GC_HEAP_OLDOBJECT_LIMIT_FACTOR=1.5 -e DISCOURSE_DB_SOCKET=/var/run/postgresql -e DISCOURSE_DB_HOST= -e DISCOURSE_DB_PORT= -e LC_ALL=en_US.UTF-8 -e LANGUAGE=en_US.UTF-8 -e DISCOURSE_DEFAULT_LOCALE=pt_BR -e DISCOURSE_FORCE_HTTPS=true -e DISCOURSE_HOSTNAME=forum.linguagemclipper.com.br -e DISCOURSE_DEVELOPER_EMAILS=anderson@linguagemclipper.com.br -e DISCOURSE_SMTP_ADDRESS=smtppro.zoho.com -e DISCOURSE_SMTP_PORT=587 -e DISCOURSE_SMTP_USER_NAME=anderson@linguagemclipper.com.br -e 'DISCOURSE_SMTP_PASSWORD=Clavis75!' -e DISCOURSE_SMTP_ENABLE_START_TLS=true -e LETSENCRYPT_ACCOUNT_EMAIL=anderson@linguagemclipper.com.br -h srv801054-app -e DOCKER_HOST_IP=172.17.0.1 --name app -t -p 8080:80 -v /var/discourse/shared/standalone:/shared -v /var/discourse/shared/standalone/log/var-log:/var/log --mac-address 02:cd:20:6d:ed:a7 local_discourse/app /sbin/boot
f221ba6dc911301795806390816be38e78c26b71d94773c814f057817b88a776
docker: Error response from daemon: driver failed programming external connectivity on endpoint app (a5dc4c7ba846ccf556189495ce62e040cea87a62cf47e44fef76b4364fcb9e4a): Error starting userland proxy: listen tcp4 0.0.0.0:8080: bind: address already in use.
root@srv801054:/var/discourse# docker ps -a
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
18cc215795b4 local_discourse/app "/sbin/boot" 22 minutes ago Created app
7cc7772ec84d discourse/base:2.0.20250226-0128 "/bin/bash -c '/usr/…" 22 hours ago Exited (0) 22 hours ago frosty_mendeleev
fb3ce2afb5a7 discourse/base:2.0.20250226-0128 "/bin/bash -c '/usr/…" 22 hours ago Exited (0) 22 hours ago determined_greider
root@srv801054:/var/discourse# sudo ss -ltnp | grep :8080
LISTEN 0 511 0.0.0.0:8080 0.0.0.0:* users:(("nginx",pid=885962,fd=26),("nginx",pid=885961,fd=26),("nginx",pid=674485,fd=26))
LISTEN 0 511 [::]:8080 [::]:* users:(("nginx",pid=885962,fd=27),("nginx",pid=885961,fd=27),("nginx",pid=674485,fd=27))
root@srv801054:/var/discourse# sudo lsof -i :8080
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
cache-mai 400747 vcache 26u IPv4 4374453 0t0 TCP localhost:45054->localhost:http-alt (ESTABLISHED)
nginx 674485 root 26u IPv4 3106797 0t0 TCP *:http-alt (LISTEN)
nginx 674485 root 27u IPv6 3106798 0t0 TCP *:http-alt (LISTEN)
nginx 885961 root 26u IPv4 3106797 0t0 TCP *:http-alt (LISTEN)
nginx 885961 root 27u IPv6 3106798 0t0 TCP *:http-alt (LISTEN)
nginx 885961 root 44u IPv4 4374454 0t0 TCP localhost:http-alt->localhost:45054 (ESTABLISHED)
nginx 885962 root 26u IPv4 3106797 0t0 TCP *:http-alt (LISTEN)
nginx 885962 root 27u IPv6 3106798 0t0 TCP *:http-alt (LISTEN)
root@srv801054:/var/discourse#