ansible-wordpress-host-init/roles/configure-nginx/files/vhost.conf.j2

42 lines
1.1 KiB
Plaintext
Raw Normal View History

2023-03-27 16:24:16 +00:00
map $sent_http_content_type $expires {
default off;
text/html epoch;
text/css max;
application/javascript max;
~image/ max;
}
server {
root /var/www/{{ vhost_name }};
index index.php index.html index.htm;
server_name {{ domain }};
listen 80;
expires $expires;
2023-04-07 16:13:15 +00:00
client_max_body_size 50M;
ErrorLog /var/log/nginx/{{ vhost_name }}-error.log
CustomLog /var/log/nginx/{{ vhost_name }}-access.log combined
2023-03-27 16:24:16 +00:00
autoindex off;
location / {
try_files $uri $uri/ @handler;
}
location /admin {
try_files $uri $uri/ /admin/index.php?$args;
}
location @handler {
if (!-e $request_filename) { rewrite / /index.php last; }
rewrite ^(.*.php)/ $1 last;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php{{ php_version }}-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}