nginx를 프록시 서버로 사용하면 속도가 매우 느리지만, docker에서 nginx를 사용하면 매우 빠릅니다! 왜 그런가요?
app.yml
templates:
#- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/sshd.template.yml"
- "templates/web.ratelimited.template.yml"
## Lets Encrypt(https)를 추가하려면 이 두 줄을 주석 해제하세요
#- "templates/web.ssl.template.yml"
#- "templates/web.letsencrypt.ssl.template.yml"
- "templates/web.socketed.template.yml"
expose:
#- "8080:80" # http
#- "444:443" # https
params:
db_default_text_search_config: "pg_catalog.english"
## db_shared_buffers를 총 메모리의 최대 25%로 설정합니다.
## bootstrap에 의해 감지된 RAM 기반으로 자동으로 설정되거나, 직접 오버라이드할 수 있습니다.
db_shared_buffers: "780MB"
## 정렬 성능을 향상시킬 수 있지만, 연결당 메모리 사용량이 증가합니다.
# db_work_mem: "512MB"
## 이 컨테이너에 사용할 Git 리비전은 무엇인가요? (기본값: tests-passed)
version: stable
env:
# 데이터베이스 설정
DISCOURSE_DB_USERNAME: ****
DISCOURSE_DB_PASSWORD: ***
DISCOURSE_DB_HOST: ***
DISCOURSE_DB_NAME: ***
DISCOURSE_DB_PORT: ***
DISCOURSE_DB_BACKUP_PORT: ***
LANG: zh_CN.UTF-8
DISCOURSE_DEFAULT_LOCALE: zh_CN
## 동시 웹 요청은 몇 개까지 지원되나요? 메모리와 CPU 코어 수에 따라 다릅니다.
## bootstrap에 의해 감지된 CPU 기반으로 자동으로 설정되거나, 직접 오버라이드할 수 있습니다.
UNICORN_WORKERS: 2
nginx 설정
server {
listen 80; listen [::]:80;
server_name my.web.org;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl http2; listen [::]:443 ssl http2;
server_name minetest.cosoc.org;
ssl_certificate /var/discourse/shared/standalone/ssl/my.web.org.cer;
ssl_certificate_key /var/discourse/shared/standalone/ssl/my.web.org.key;
ssl_session_tickets off;
http2_idle_timeout 5m; # 기본값 3m에서 증가
location / {
proxy_pass http://unix:/var/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;
}
왜 nginx가 이렇게 느린 것일까요??? 하지만 nginx를 사용하지 않으면 빠릅니다!!