server {
server_name site.com www.site.com;
root /home/site;
listen 80;
index index.html index.htm index.php;
error_log /home/site/error.log error;
set $cache_uri $request_uri;
location /q {
index index.php index.html index.htm;
if (!-f $request_filename) {
rewrite ^/q/(.+)?$ /q/index.php?qa-rewrite=$1 last;
}
}
location / {
index index.php index.html index.htm;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
location ~ \.php$ {
fastcgi_buffers 8 256k;
fastcgi_buffer_size 128k;
fastcgi_intercept_errors on;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
fastcgi_read_timeout 300;
if ( -f $request_filename ) {
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
}
location ~* ^.+\.(rss|atom|jpg|jpeg|gif|png|ico|rtf|js|css|svg)$ {
expires max;
}
}