forked from ISTI-ansible-roles/ansible-roles
111 lines
3.1 KiB
Plaintext
111 lines
3.1 KiB
Plaintext
upstream php {
|
|
server {{ item.listen }};
|
|
}
|
|
|
|
server {
|
|
listen {{ http_port }};
|
|
## Your website name goes here.
|
|
server_name {{ item.virthost }};
|
|
## Your only path reference.
|
|
root {{ item.doc_root }};
|
|
|
|
{% if letsencrypt_acme_install %}
|
|
include /etc/nginx/snippets/letsencrypt-proxy.conf;
|
|
{% endif %}
|
|
|
|
## This should be in your http block and if it is, it's not needed here.
|
|
index index.php;
|
|
|
|
|
|
# redirect server error pages to the static page /50x.html
|
|
#
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
|
|
location = /favicon.ico {
|
|
log_not_found off;
|
|
access_log off;
|
|
}
|
|
|
|
location = /robots.txt {
|
|
allow all;
|
|
log_not_found off;
|
|
access_log off;
|
|
}
|
|
|
|
# don't send the nginx version number in error pages and Server header
|
|
server_tokens off;
|
|
|
|
{% if nginx_client_body_temp_dir is defined %}
|
|
client_body_temp_path {{ nginx_client_body_temp_dir }} 1 2;
|
|
{% endif %}
|
|
|
|
location / {
|
|
return 301 https://{{ item.virthost }}$request_uri;
|
|
}
|
|
|
|
}
|
|
|
|
server {
|
|
listen {{ https_port }} ssl;
|
|
## Your website name goes here.
|
|
server_name {{ item.virthost }};
|
|
## Your only path reference.
|
|
root {{ item.doc_root }};
|
|
|
|
{% if letsencrypt_acme_install %}
|
|
include /etc/nginx/snippets/nginx-server-ssl.conf;
|
|
{% endif %}
|
|
|
|
## This should be in your http block and if it is, it's not needed here.
|
|
index index.php;
|
|
|
|
|
|
# redirect server error pages to the static page /50x.html
|
|
#
|
|
error_page 500 502 503 504 /50x.html;
|
|
location = /50x.html {
|
|
root /usr/share/nginx/html;
|
|
}
|
|
|
|
location = /favicon.ico {
|
|
log_not_found off;
|
|
access_log off;
|
|
}
|
|
|
|
location = /robots.txt {
|
|
allow all;
|
|
log_not_found off;
|
|
access_log off;
|
|
}
|
|
|
|
# don't send the nginx version number in error pages and Server header
|
|
server_tokens off;
|
|
|
|
{% if nginx_client_body_temp_dir is defined %}
|
|
client_body_temp_path {{ nginx_client_body_temp_dir }} 1 2;
|
|
{% endif %}
|
|
|
|
location / {
|
|
# This is cool because no php is touched for static content.
|
|
# include the "?$args" part so non-default permalinks doesn't break when using query string
|
|
try_files $uri $uri/ /index.php?$args;
|
|
}
|
|
|
|
location ~ \.php$ {
|
|
#NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
|
|
try_files $uri =404;
|
|
fastcgi_intercept_errors on;
|
|
fastcgi_pass php;
|
|
fastcgi_param REMOTE_ADDR $remote_addr;
|
|
include fastcgi_params;
|
|
}
|
|
|
|
location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
|
|
expires max;
|
|
log_not_found off;
|
|
}
|
|
}
|