Move each Mono web app into its own subdomain

This commit is contained in:
coolneng 2021-05-11 13:56:04 +02:00
parent 6315ab62af
commit 4cc39850b9
Signed by: coolneng
GPG Key ID: 9893DA236405AF57
1 changed files with 28 additions and 33 deletions

View File

@ -43,28 +43,31 @@
};
};
virtualHosts = {
"frontend.coace.duckdns.org" = {
"gcw.coace.duckdns.org" = {
enableACME = true;
forceSSL = true;
root = "/vault/backups/frontend/inetpub/wwwroot";
locations = {
"/few/".extraConfig = ''
root = "/vault/backups/frontend/inetpub/wwwroot/gcw";
locations."/".extraConfig = ''
fastcgi_index Default.aspx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root/few/$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_param PATH_INFO "";
fastcgi-mono-server4 /applications=/few/:/vault/backups/frontend/inetpub/wwwroot/few/socket=tcp:127.0.0.1:9000;
include ${pkgs.nginx}/conf/fastcgi_params;
'';
"/gcw/".extraConfig = ''
fastcgi_index Default.aspx;
fastcgi_pass 127.0.0.1:9000;
fastcgi_param SCRIPT_FILENAME $document_root/few/$fastcgi_script_name;
fastcgi_param PATH_INFO "";
fastcgi-mono-server4 /applications=/gcw/:/vault/backups/frontend/inetpub/wwwroot/gcw/socket=tcp:127.0.0.1:9000;
fastcgi-mono-server4 /applications=gcw.coace.duckns.org/:/vault/backups/frontend/inetpub/wwwroot/gcw/socket=tcp:127.0.0.1:9001;
include ${pkgs.nginx}/conf/fastcgi_params;
'';
};
"few.coace.duckdns.org" = {
enableACME = true;
forceSSL = true;
root = "/vault/backups/frontend/inetpub/wwwroot/few";
locations."/".extraConfig = ''
fastcgi_index Default.aspx;
fastcgi_pass 127.0.0.1:9001;
fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
fastcgi_param PATH_INFO "";
fastcgi-mono-server4 /applications=few.coace.duckdns.org/:/vault/backups/frontend/inetpub/wwwroot/few/socket=tcp:127.0.0.1:9001;
include ${pkgs.nginx}/conf/fastcgi_params;
'';
};
};
};
@ -75,7 +78,7 @@
email = "secretario@arquitectosdeceuta.com";
certs."coace.duckdns.org" = {
webroot = "/var/lib/acme/acme-challenge";
extraDomainNames = [ "frontend.coace.duckdns.org" ];
extraDomainNames = [ "few.coace.duckdns.org" "gcw.coace.duckdns.org" ];
};
};
@ -103,19 +106,11 @@
wantedBy = [ "default.target" ];
path = with pkgs; [ mono6 ];
script = ''
lockfile=/tmp/mono-service
${pkgs.mono6}/bin/mono-service -d:/vault/backups/frontend/inetpub/wwwroot/gcw -l:$lockfile
${pkgs.mono6}/bin/mono-service -d:/vault/backups/frontend/inetpub/wwwroot/few -l:$lockfile
gcw_lockfile=/tmp/mono-service-gcw
few_lockfile=/tmp/mono-service-few
${pkgs.mono6}/bin/mono-service --applications /:/vault/backups/frontend/inetpub/wwwroot/gcw -l:$gcw_lockfile --socket=tcp:127.0.0.1:9000
${pkgs.mono6}/bin/mono-service --applications /:/vault/backups/frontend/inetpub/wwwroot/few -l:$few_lockfile --socket=tcp:127.0.0.1:9001
'';
serviceConfig = {
Type = "oneshot";
RemainAfterExit = "yes";
User = "nginx";
Group = "nginx";
ExecStop = ''
kill `cat $lockfile`
'';
};
before = [ "nginx.service" ];
};
}