Answer the question
In order to leave comments, you need to log in
Setting cache/buff on nginx for multiple identical sites (java)?
Good afternoon!
There are vps with nginx-proxy on board. This vps has 2 network interfaces: one looks to the Internet, the other to the local area (let's say so).
There are many identical sites (tomcat, java, postgres) spinning in the locale, but with different data. Each of the sites is available on its own domain. The nginx access config is now:
1)
server {
listen 80 default_server;
server_name _;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name *.domain.ru;
resolver $IP valid=5m;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_certificate /etc/ssl/certs/domain.crt;
ssl_certificate_key /etc/ssl/certs/domain.key;
ssl_session_cache shared:SSL:10m;
ssl_session_timeout 10m;
gzip on;
gzip_vary on;
gzip_min_length 1000;
gzip_proxied any;
gzip_comp_level 7;
gzip_buffers 16 8k;
gzip_types text/plain text/css application/json application/javascript text/xml application/xml application/xml+rss text/javascript image/png;
location = / {
return 301 https://$host:443/crm;
}
location /images {
root /var/www/html/;
autoindex off;
expires 30d;
}
location /crm/icons {
root /var/www/html/;
autoindex off;
expires 30d;
}
location /crm/images {
root /var/www/html/;
autoindex off;
expires 30d;
}
location /crm/img {
root /var/www/html/;
autoindex off;
expires 30d;
}
location / {
proxy_pass https://$host:443;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $remote_addr;
}
}
Answer the question
In order to leave comments, you need to log in
Something like NGINX Content Caching .
Set it up for /images , /crm/icons , /crm/images , /crm/img . For location / do not configure.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question