88 lines
2.4 KiB
Plaintext
88 lines
2.4 KiB
Plaintext
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
|
|
server_name ip.clerie.de;
|
|
|
|
return 301 https://$host$request_uri;
|
|
}
|
|
|
|
server {
|
|
listen [::]:443 ssl;
|
|
listen 443 ssl;
|
|
|
|
server_name ip.clerie.de;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/ip.clerie.de/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/ip.clerie.de/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
|
|
location / {
|
|
types { } default_type "text/html; charset=utf-8";
|
|
return 200 '
|
|
<html>
|
|
<head>
|
|
<title>ip.clerie.de</title>
|
|
<script>
|
|
function httpGet(url, loaded, error) {
|
|
var xmlHttp = new XMLHttpRequest();
|
|
xmlHttp.open("GET", url + ((/\?/).test(url) ? "&" : "?") + (new Date()).getTime(), true);
|
|
xmlHttp.onload = () => {
|
|
if(xmlHttp.status == 200) {
|
|
loaded(xmlHttp.responseText);
|
|
}
|
|
else {
|
|
error();
|
|
}
|
|
};
|
|
xmlHttp.onerror = () => {error();};
|
|
xmlHttp.send(null);
|
|
}
|
|
function setText(id, text) {
|
|
document.getElementById(id).innerText = text;
|
|
}
|
|
httpGet("https://ip4.clerie.de/",
|
|
(response) => {setText("ip4", response);},
|
|
() => {setText("ip4", "Error");}
|
|
);
|
|
httpGet("https://ip6.clerie.de/",
|
|
(response) => {setText("ip6", response);},
|
|
() => {setText("ip6", "Error");}
|
|
);
|
|
</script>
|
|
</head>
|
|
<body>
|
|
<h1>ip.clerie.de</h1>
|
|
<ul>
|
|
<li><b>IPv6:</b> <span id="ip6">Loading...</span></li>
|
|
<li><b>IPv4:</b> <span id="ip4">Loading...</span></li>
|
|
</ul>
|
|
<p>Use bash and curl: <code>curl ip{4,6}.clerie.de</code></p>
|
|
<p><small>Because any other "Whats my IP?"-tool sucks. <a href="https://git.clerie.de/clerie/ip.clerie.de">Host yourself :3</a></small></p>
|
|
</body>
|
|
</html>
|
|
';
|
|
}
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
listen [::]:80;
|
|
listen [::]:443 ssl;
|
|
listen 443 ssl;
|
|
|
|
server_name ip4.clerie.de ip6.clerie.de;
|
|
|
|
ssl_certificate /etc/letsencrypt/live/ip.clerie.de/fullchain.pem;
|
|
ssl_certificate_key /etc/letsencrypt/live/ip.clerie.de/privkey.pem;
|
|
include /etc/letsencrypt/options-ssl-nginx.conf;
|
|
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem;
|
|
|
|
location / {
|
|
types { } default_type "text/plain; charset=utf-8";
|
|
add_header Access-Control-Allow-Origin *;
|
|
return 200 '$remote_addr\n';
|
|
}
|
|
}
|