From aed86dd36a0779d8a34ff241cb37c4b063ef6d77 Mon Sep 17 00:00:00 2001 From: Tykayn Date: Mon, 12 Jun 2023 23:27:17 +0200 Subject: [PATCH] add domains --- nginx_config_maker/index.mjs | 20 +++++++- nginx_config_maker/model.symfony.mjs | 20 +++++++- nginx_config_maker/model.wordpress.mjs | 67 +++++++++++++++++++++++++- 3 files changed, 103 insertions(+), 4 deletions(-) diff --git a/nginx_config_maker/index.mjs b/nginx_config_maker/index.mjs index cdacf2b0..64d3b73e 100644 --- a/nginx_config_maker/index.mjs +++ b/nginx_config_maker/index.mjs @@ -67,7 +67,17 @@ const domainsConfig = [{ domain: 'www.clairelemoine.art', framework: 'wordpress', disableSSL: false, - }, { + }, + + { + LXCcontainerLocalIP, + LXCcontainerProtocol, + name: 'Blog Qzine', + domain: 'qzine.fr', + framework: 'symfony', + disableSSL: false, + }, + { LXCcontainerLocalIP, LXCcontainerProtocol, name: 'Funky Framadate Démo', @@ -90,6 +100,14 @@ const domainsConfig = [{ framework: 'symfony', disableSSL: false, }, + { + LXCcontainerLocalIP, + LXCcontainerProtocol, + name: 'Sondages Qzine', + domain: 'sondages.qzine.fr', + framework: 'symfony', + disableSSL: false, + }, ] // autres frameworks: // nextcloud: cloud.tykayn.fr diff --git a/nginx_config_maker/model.symfony.mjs b/nginx_config_maker/model.symfony.mjs index 318e1365..a8a1330b 100644 --- a/nginx_config_maker/model.symfony.mjs +++ b/nginx_config_maker/model.symfony.mjs @@ -34,7 +34,25 @@ server { } `, - containerNginxConf : `` + containerNginxConf : `server { + if ($host = ${domainConfig.name}) { + return 301 https://$host$request_uri; + } + + + listen 80 ; + listen [::]:80 ; + server_name ${domainConfig.name}; + # enforce https + return 301 https://$server_name$request_uri; + + add_header Permissions-Policy "interest-cohort=()"; + root /home/www/tykayn/${domainConfig.name}/; + index index.php index.html; + +} + +` } return model; } \ No newline at end of file diff --git a/nginx_config_maker/model.wordpress.mjs b/nginx_config_maker/model.wordpress.mjs index 41c42d8f..5dc67a51 100644 --- a/nginx_config_maker/model.wordpress.mjs +++ b/nginx_config_maker/model.wordpress.mjs @@ -3,7 +3,7 @@ * @param domainConfig * @returns {{homeNginxConf: string, containerNginxConf: string}} */ -export function makeHostFileForWordpress(domainConfig){ +export function makeHostFileForWordpress (domainConfig) { /** * example: @@ -45,7 +45,70 @@ server { add_header Permissions-Policy "interest-cohort=()"; } `, - containerNginxConf: `` + containerNginxConf: ` + # ============ ${domainConfig.name} | côté conteneur LXC =============== + server { + if ($host = www.cipherbliss.com) { + return 301 https://$host$request_uri; + } # managed by Certbot + + + listen 80 ; + listen [::]:80 ; + server_name www.cipherbliss.com; + # enforce https + return 301 https://$server_name$request_uri; + + add_header Permissions-Policy "interest-cohort=()"; + + +} +server { + listen 443 ssl http2; + listen [::]:443 ssl http2; + server_name www.cipherbliss.com; + + ssl_certificate /etc/letsencrypt/live/www.cipherbliss.com-0001/fullchain.pem; # managed by Certbot + ssl_certificate_key /etc/letsencrypt/live/www.cipherbliss.com-0001/privkey.pem; # managed by Certbot + + # Path to the root of your installation + root /home/www/tykayn/cipherbliss/; + + ## This should be in your http block and if it is, it's not needed here. + index index.php; + + location = /favicon.ico { + log_not_found off; + access_log off; + } + + location = /robots.txt { + allow all; + log_not_found off; + access_log off; + } + 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 + include fastcgi.conf; + fastcgi_intercept_errors on; + fastcgi_pass php-handler; + } + + location ~* \\.(js|css|png|jpg|jpeg|gif|ico)$ { + expires max; + log_not_found off; + } + add_header Permissions-Policy "interest-cohort=()"; +} + + + ` } return model } \ No newline at end of file