ansible-ffibk/roles/service-nginx-wordpress/templates/nginx-vhost.j2

53 lines
1.3 KiB
Text
Raw Permalink Normal View History

server {
listen 80;
listen [::]:80;
server_name {{ wp_service_name }};
return 301 https://$http_host$request_uri;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
server_name {{ wp_service_name }};
ssl_certificate {{ nginx_ssl_directory }}fullchain.pem;
ssl_certificate_key {{ nginx_ssl_directory }}privkey.pem;
ssl_prefer_server_ciphers on;
root {{ wp_install_dir }};
# Add index.php to the list if you are using PHP
index index.php;
server_name {{ wp_service_name }};
client_max_body_size 1024M;
location / {
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
#try_files $uri $uri/ =404;
try_files $uri $uri/ /index.php$is_args$args;
}
location = /favicon.ico { log_not_found off; access_log off; }
location = /robots.txt { log_not_found off; access_log off; allow all; }
location ~* \.(css|gif|ico|jpeg|jpg|js|png)$ {
expires max;
log_not_found off;
}
# pass the PHP scripts to FastCGI server listening on socket
location ~ \.php$ {
try_files $uri =404;
include /etc/nginx/fastcgi_params;
fastcgi_read_timeout 3600s;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass 127.0.0.1:9000;
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_index index.php;
}
}