Usare nginx come server proxy è molto lento, ma è velocissimo se si usa nginx in Docker! Perché?
app.yml
templates:
#- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/sshd.template.yml"
- "templates/web.ratelimited.template.yml"
## Decommenta queste due righe se desideri aggiungere 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"
## Imposta db_shared_buffers a un massimo del 25% della memoria totale.
## verrà impostato automaticamente da bootstrap in base alla RAM rilevata, oppure puoi sovrascriverlo
db_shared_buffers: "780MB"
## può migliorare le prestazioni di ordinamento, ma aumenta l'uso di memoria per connessione
# db_work_mem: "512MB"
## Quale revisione Git dovrebbe usare questo container? (default: tests-passed)
version: stable
env:
# Configurazione database
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
## Quante richieste web simultanee sono supportate? Dipende dalla memoria e dai core CPU.
## verrà impostato automaticamente da bootstrap in base alle CPU rilevate, oppure puoi sovrascriverlo
UNICORN_WORKERS: 2
configurazione 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; # aumentato dal valore predefinito di 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;
}
Perché nginx si comporta così lentamente??? Ma è veloce quando non lo si usa!!