Answer the question
In order to leave comments, you need to log in
Why is nginx not serving gz files?
I have the following nginx config:
server {
listen 80;
server_name ~^(www\.)?(?<sname>.+?).site.ru$;
root /var/www/kvz/$sname.site.ru/web;
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri /app.php$is_args$args;
}
location ~ ^/static/ {
gzip_static on;
expires max;
add_header Cache-Control public;
add_header Last-Modified "";
add_header ETag "";
}
# DEV
location ~ ^/(app_dev|config)\.php(/|$) {
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
}
# PROD
location ~ ^/app\.php(/|$) {
fastcgi_pass unix:/run/php-fpm/php-fpm.sock;
fastcgi_split_path_info ^(.+\.php)(/.*)$;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
internal;
}
access_log /var/log/nginx/$sname-access.log;
error_log /var/log/nginx/$sname-error.log debug;
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question