Created
March 13, 2024 19:06
-
-
Save artickl/f3ea3642500d38a392b7d8bf200d868e to your computer and use it in GitHub Desktop.
NGINX My IP Page
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# simple way to show public IP address of the client | |
# anyone can access it in the browser (like https://ip.example.com) | |
# or can be used in some scripting (like "curl ip.example.com") | |
# simply on NGINX functionality without any kind of additional tools or plugins | |
# just place this nginx config to /etc/nginx/sites-available/ip | |
# make a link in /etc/nginx/sites-enabled/ ($ ln /etc/nginx/sites-available/ip) | |
# reload nginx ($ service nginx reload) | |
server { | |
server_name ip.*; | |
listen 80; | |
listen [::]:80; | |
#listen [::]:443 ssl; | |
#listen 443 ssl; | |
#ssl_certificate %certificate% | |
#ssl_certificate_key %key% | |
root /dev/null; | |
gzip on; | |
access_log /var/log/nginx/ip.access.log; | |
error_log /var/log/nginx/ip.error.log crit; | |
location / { | |
default_type text/plain; | |
return 200 "$remote_addr\n"; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment