dn42-myip/nginx-site.j2

27 lines
826 B
Text
Raw Permalink Normal View History

2024-11-20 23:31:57 +00:00
server {
listen [fd32:6b0:70a6:8181::81]:80;
{% if unicastv6 is defined %}
2024-11-20 23:31:57 +00:00
listen [{{ unicastv6 }}]:80;
{% endif %}
2024-11-20 23:31:57 +00:00
server_name myip.9pfs.dn42;
server_name *.myip.9pfs.dn42;
server_name [fd32:6b0:70a6:8181::81];
{% if unicastv6 is defined %}
server_name [{{ unicastv6 }}];
{% endif %}
2024-11-20 23:31:57 +00:00
location = /raw {
return 200 '$remote_addr\n';
default_type text/plain;
}
2024-11-20 23:31:57 +00:00
location = /api {
default_type application/json;
add_header 'Access-Control-Allow-Origin' '*';
return 200 '{\n\t"version": "1.0",\n\t"ip": "$remote_addr",\n\t"server": "$server_addr",\n\t"node_as": "4242422002",\n\t"node_location": "{% if country is defined %}{{ country }}{% else %}US{% endif %}",\n\t"node_id": "{% if fqdn is defined %}{{ fqdn }}{% else %}myip.9pfs.dn42{% endif %}"\n}';
2024-11-20 23:31:57 +00:00
}
location = / {
{% include 'nginx-html.j2' %}
}
}