Using nginx as proxy server is very slow, but it is very fast if using nginx in docker! Why?
app.yml
templates:
#- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/sshd.template.yml"
- "templates/web.ratelimited.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"
- "templates/web.socketed.template.yml"
expose:
#- "8080:80" # http
#- "444:443" # https
params:
db_default_text_search_config: "pg_catalog.english"
## Set db_shared_buffers to a max of 25% of the total memory.
## will be set automatically by bootstrap based on detected RAM, or you can override
db_shared_buffers: "780MB"
## can improve sorting performance, but adds memory usage per-connection
# db_work_mem: "512MB"
## Which Git revision should this container use? (default: 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
## How many concurrent web requests are supported? Depends on memory and CPU cores.
## will be set automatically by bootstrap based on detected CPUs, or you can override
UNICORN_WORKERS: 2
nginx config
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; # up from 3m default
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;
}
Why is nginx acting so slowly??? But it’s fast when you don’t use it!!