modif creation dossier common app nextcloud
[lhc/ansible.git] / templates / nginx_nuage_server.j2
index 661950a..f25b86f 100644 (file)
@@ -5,8 +5,9 @@ map $arg_v $asset_immutable {
 }
 server {
        listen 80;
-       server_name {{ SITE }}.{{ DOMAIN }}.{{ TLD }};
+       server_name {{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }};
        #disable_symlinks if_not_owner;
+{% if ssl_ready is defined and ssl_ready %}
 
        # Prevent nginx HTTP Server Detection
        server_tokens off;
@@ -14,24 +15,23 @@ server {
        # Enforce HTTPS
        return 301 https://$server_name$request_uri;
 
+       access_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ config_ss_domain }}/access.log main buffer=32k;
+       error_log  /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ config_ss_domain }}/error.log warn;
 
-       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;
 }
 server {
        listen 443 ssl http2;
-       server_name {{ SITE }}.{{ DOMAIN }}.{{ TLD }};
+       server_name {{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }};
 
        # Path to the root of your installation
-       root /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/nextcloud;
+       root /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ config_ss_domain }}/nextcloud;
 
        disable_symlinks if_not_owner;
-{% if besoin_https == 'oui' %}
-       ssl_certificate /etc/letsencrypt/live/{{ SITE }}.{{ DOMAIN }}.{{ TLD }}/fullchain.pem;
-       ssl_certificate_key /etc/letsencrypt/live/{{ SITE }}.{{ DOMAIN }}.{{ TLD }}/privkey.pem;
+       ssl_certificate /etc/letsencrypt/live/{{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }}/fullchain.pem;
+       ssl_certificate_key /etc/letsencrypt/live/{{ config_ss_domain }}.{{ DOMAIN }}.{{ TLD }}/privkey.pem;
 {% endif %}
-       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;
+       access_log /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ config_ss_domain }}/access.log main buffer=32k;
+       error_log  /home/sites/log/nginx/{{ TLD }}/{{ DOMAIN }}/{{ config_ss_domain }}/error.log warn;
 
        # Prevent nginx HTTP Server Detection
        server_tokens off;
@@ -88,11 +88,11 @@ server {
        }
 
        location ~ /common-apps/(.*)$ {
-         alias /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/common/$1;
+         alias /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ config_ss_domain }}/common/$1;
        }
 
        location ~ /instance-apps/(.*)$ {
-         alias /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/apps/$1;
+         alias /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ config_ss_domain }}/apps/$1;
        }
 
        # Specify how to handle directories -- specifying `/index.php$request_uri`
@@ -165,8 +165,8 @@ server {
          fastcgi_param modHeadersAvailable true;         # Avoid sending the security headers twice
          fastcgi_param front_controller_active true;     # Enable pretty urls
          
-         fastcgi_param NEXTCLOUD_CONFIG_DIR /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ SITE }}/config;
-         fastcgi_pass unix:/run/php{{ php_version}}/fpm/php_{{ SIGLE }}_{{ SITE }};
+         fastcgi_param NEXTCLOUD_CONFIG_DIR /home/sites/data/{{ TLD }}/{{ DOMAIN }}/{{ config_ss_domain }}/config;
+         fastcgi_pass unix:/run/php{{ php_version }}/fpm/php_{{ SIGLE }}_{{ config_ss_domain }};
        
          #fastcgi_intercept_errors on;
          fastcgi_request_buffering off;