ajout support SITE WP
[lhc/ansible.git] / templates / nginx_WP_server.j2
diff --git a/templates/nginx_WP_server.j2 b/templates/nginx_WP_server.j2
new file mode 100644 (file)
index 0000000..a501e6d
--- /dev/null
@@ -0,0 +1,43 @@
+server {
+       listen 80;
+       server_name {{ DOMAIN }}.{{ TLD }} {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }};
+       root /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/;
+       access_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/access.log main buffer=32k;
+       error_log  /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/error.log warn;
+{% if ssl_ready is defined and ssl_ready %}
+    return 301 https://$server_name$request_uri;
+ }
+server {
+       listen 443;
+    ssl_certificate /etc/letsencrypt/live/{{ SITE }}.{{ DOMAIN }}.{{ TLD }}/fullchain.pem;
+    ssl_certificate_key /etc/letsencrypt/live/{{ SITE }}.{{ DOMAIN }}.{{ TLD }}/privkey.pem;
+    access_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/access.log main buffer=32k;
+    error_log  /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/error.log warn;
+{% endif %}
+       server_name {{ DOMAIN }}.{{ TLD }} {{ config_ss_domain | default(SITE) }}.{{ DOMAIN }}.{{ TLD }};
+       root /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/;
+       index  index.php index.html index.htm;
+    client_max_body_size 500M;
+    location / {
+        try_files $uri $uri/ /index.php?$args;
+    }
+    location = /favicon.ico {
+        log_not_found off;
+        access_log off;
+    }
+    location ~* \.(js|css|png|jpg|jpeg|gif|ico)$ {
+        expires max;
+        log_not_found off;
+    }
+    location = /robots.txt {
+        allow all;
+        log_not_found off;
+        access_log off;
+    }
+    location ~ \.php$ {
+         include snippets/fastcgi-php.conf;
+         fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;
+         fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
+         include fastcgi_params;
+    }
+}
\ No newline at end of file