2023-01-22 09:53:09 +00:00
|
|
|
server {
|
2023-05-31 13:19:21 +00:00
|
|
|
server_name {{#dns}} {{.}} {{/dns}};
|
|
|
|
access_log {{{nginx.logs}}}.access.log main;
|
2023-04-27 04:17:20 +00:00
|
|
|
|
2023-11-19 15:34:37 +00:00
|
|
|
set $trackme 0;
|
|
|
|
if ( $uri ~ ^/trk/ ){
|
|
|
|
set $trackme 1;
|
|
|
|
}
|
|
|
|
access_log {{{nginx.logs}}}.trk.log tracker if=$trackme ;
|
|
|
|
location ~* /trk/ {
|
|
|
|
if ( $uri ~ ^/trk/redirect ){
|
|
|
|
return 301 $arg_url;
|
|
|
|
}
|
2023-11-05 11:03:25 +00:00
|
|
|
rewrite ^/trk/(.*)$ /$1;
|
2023-11-19 15:34:37 +00:00
|
|
|
}
|
2023-11-05 11:03:25 +00:00
|
|
|
|
2023-11-19 15:34:37 +00:00
|
|
|
location /Checkjson.js {
|
|
|
|
alias {{{dirapi}}}/api/models/Checkjson.js;
|
|
|
|
}
|
2023-06-12 05:27:34 +00:00
|
|
|
location ~* /nationchains/(blocks|pagans|towns|nations)/ {
|
2023-05-31 13:19:21 +00:00
|
|
|
# Warning: never add tribes for keeping it private
|
|
|
|
root {{{dirapi}}}/;
|
|
|
|
}
|
2023-11-05 11:03:25 +00:00
|
|
|
location ~* /nationchains/models/ {
|
|
|
|
rewrite /nationchains/models/(.*$) /$1 break;
|
|
|
|
root {{{dirapi}}}/api/models/lg/;
|
|
|
|
}
|
2023-06-12 05:27:34 +00:00
|
|
|
location ~* /nationchains/schema/ {
|
|
|
|
#outside of nationchains for git purpose
|
|
|
|
rewrite /nationchains/schema/(.*$) /$1 break;
|
2023-06-28 13:23:17 +00:00
|
|
|
root {{{dirapi}}}/adminapi/schema/;
|
2023-06-12 05:27:34 +00:00
|
|
|
}
|
2023-12-05 06:42:35 +00:00
|
|
|
location ~* /{{tribeId}}/schema/{
|
|
|
|
rewrite /{{tribeId}}/schema/(.*$) /$1 break;
|
|
|
|
root {{dirtown}}/tribes/{{tribeId}}/schema/;
|
|
|
|
}
|
|
|
|
|
|
|
|
location ~* /{{tribeId}}/models/{
|
|
|
|
rewrite /{{tribeId}}/models/(.*$) /$1 break;
|
|
|
|
root {{dirtown}}/tribes/{{tribeId}}/api/models/lg/;
|
|
|
|
}
|
|
|
|
|
2023-05-31 13:19:21 +00:00
|
|
|
# /plugins/pluginame/components/xxx?plugin=pluginname&pluginkey=key
|
|
|
|
# acess if exist pluginkey
|
|
|
|
location /plugins/ {
|
|
|
|
add_header X-debug "plugins local $arg_plugin/keys/$arg_pluginkey sent";
|
|
|
|
root {{{nginx.fswww}}}/plugins/;
|
|
|
|
if (-f {{{nginx.fswww}}}/plugins/$arg_plugin/keys/$arg_pluginkey) {
|
|
|
|
rewrite /plugins/([^/]+)/components/([^\?]+) /$1/components/$2 break;
|
|
|
|
}
|
|
|
|
return 403 "No valid token access for plugin:$arg_plugin with token:$arg_pluginkey please ask your admin";
|
|
|
|
}
|
2023-01-22 09:53:09 +00:00
|
|
|
|
2023-05-31 13:19:21 +00:00
|
|
|
location /cdn/ {
|
2023-11-05 11:03:25 +00:00
|
|
|
expires 1y;
|
|
|
|
add_header Cache-Control "public";
|
|
|
|
rewrite /cdn/(.*$) /$1 break;
|
|
|
|
root {{{nginx.fswww}}}/cdn/;
|
2023-05-31 13:19:21 +00:00
|
|
|
}
|
2023-01-22 09:53:09 +00:00
|
|
|
|
2023-05-31 13:19:21 +00:00
|
|
|
location /spacedev/ {
|
|
|
|
rewrite /spacedev/(.*$) /$1 break;
|
|
|
|
root {{{nginx.fswww}}}spacedev/{{{nginx.website}}}/dist/;
|
|
|
|
}
|
|
|
|
|
|
|
|
location /api/ {
|
|
|
|
rewrite /api/(.*$) /$1 break;
|
|
|
|
proxy_pass http://localhost:{{{api.port}}};
|
|
|
|
proxy_redirect off;
|
|
|
|
include proxy_params;
|
|
|
|
}
|
2023-11-05 11:03:25 +00:00
|
|
|
|
|
|
|
location /apxwebapp/ {
|
|
|
|
rewrite /apxwebapp/(.*$) /$1 break;
|
|
|
|
root {{{dirapxwebapp}}}/apxwebapp/;
|
|
|
|
index index.html index_en.html;
|
|
|
|
}
|
|
|
|
|
2023-06-12 05:27:34 +00:00
|
|
|
#to add htpasswd install apache2-utils => sudo htpasswd -c dirtown/tribes/tribeId/.htpasswd loginname passwd see man for
|
|
|
|
option
|
2023-05-31 13:19:21 +00:00
|
|
|
|
|
|
|
location / {
|
2023-06-12 05:27:34 +00:00
|
|
|
{{#nginx.private}}
|
2023-06-01 05:30:05 +00:00
|
|
|
auth_basic "Mot de passe {{nginx.privatelogin}}";
|
2023-06-12 05:27:34 +00:00
|
|
|
auth_basic_user_file {{dirtown}}/tribes/{{tribeId}}/.htpasswd;
|
2023-06-01 05:30:05 +00:00
|
|
|
{{/nginx.private}}
|
2023-05-31 13:19:21 +00:00
|
|
|
root {{{nginx.fswww}}}/{{{nginx.website}}};
|
|
|
|
index index.html {{{nginx.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;
|
2023-01-22 09:53:09 +00:00
|
|
|
}
|
2023-05-31 13:19:21 +00:00
|
|
|
}
|