1
0
forked from apxtri/apxtri
apxtri/setup/conf/nginx/nginxmodelwebsite.conf.mustache
2024-03-15 08:49:23 +01:00

81 lines
2.4 KiB
Plaintext
Executable File

server {
server_name {{#dns}} {{.}} {{/dns}};
access_log {{foldertowns}}/{{townId}}-{{nationId}}/tribes/log/nginx/{{tribeId}}_{{website}}.access.log main;
set $trackme 0;
if ( $uri ~ ^/trk/ ){
set $trackme 1;
}
access_log {{foldertowns}}/{{townId}}-{{nationId}}/tribes/log/nginx/{{tribeId}}_{{website}}.trk.log tracker if=$trackme ;
location ~* /trk/ {
if ( $uri ~ ^/trk/redirect ){
return 301 $arg_url;
}
rewrite ^/trk/(.*)$ /$1;
}
location /Checkjson.js {
alias {{foldertowns}}/{{townId}}-{{nationId}}/apxtri/models/Checkjson.js;
}
location ~* /nationchains/(blocks|pagans|towns|nations)/ {
# Warning: never add tribes for keeping it private
root {{foldertowns}}/{{townId}}-{{nationId}}/nationchains/;
}
location ~* /nationchains/models/ {
rewrite /nationchains/models/(.*$) /$1 break;
root {{foldertowns}}/{{townId}}-{{nationId}}/apxtri/models/lg/;
}
location ~* /nationchains/schema/ {
#outside of nationchains for git purpose
rewrite /nationchains/schema/(.*$) /$1 break;
root {{{foldertowns}}/{{townId}}-{{nationId}}/tribes/adminapi/schema/;
}
location ~* /{{tribeId}}/schema/{
rewrite /{{tribeId}}/schema/(.*$) /$1 break;
root {{foldertowns}}/{{townId}}-{{nationId}}/tribes/{{tribeId}}/schema/;
}
location ~* /{{tribeId}}/models/{
rewrite /{{tribeId}}/models/(.*$) /$1 break;
root {{foldertowns}}/{{townId}}-{{nationId}}/tribes/{{tribeId}}/api/models/lg/;
}
location /cdn/ {
expires 1y;
add_header Cache-Control "public";
rewrite /cdn/(.*$) /$1 break;
root {{foldertowns}}/{{townId}}-{{nationId}}/tribes/{{tribeId}}/www//cdn/;
}
location /api/ {
rewrite /api/(.*$) /$1 break;
proxy_pass http://localhost:{{{api.port}}};
proxy_redirect off;
include proxy_params;
}
location /apxwebapp/ {
rewrite /apxwebapp/(.*$) /$1 break;
root {{foldertowns}}/apxwebapp/;
index index.html index_en.html;
}
#to add htpasswd install apache2-utils => sudo htpasswd -c dirtown/tribes/tribeId/.htpasswd loginname passwd see man for
option
location / {
{{#private}}
auth_basic "Mot de passe {{privatelogin}}";
auth_basic_user_file {{{foldertowns}}/{{townId}}-{{nationId}}/tribes/{{tribeId}}/.htpasswd;
{{/private}}
root {{foldertowns}}/{{townId}}-{{nationId}}/tribes/{{tribeId}}/www/{{{website}}};
index index.html {{{pageindex}}};
}
error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/local/nginx/html;
}
}