Nginx - check your public IP
Sometimes you just need your public IP, and nothing more. A simple config change in nginx can offer you exactly this.
Add the following location
segment to the server
segment of your choice. You could replace /ip
with another term.
location /ip { default_type text/plain; return 200 $remote_addr;}
Now, if you visit the destination of the server
segment with the subdirectory /ip
, you'll find your IP. Try it out and visit https://itt.sh/ip.
- The neat part is that it works well in the CLI too:
curl itt.sh/ip
wget -qO- itt.sh/ip
- Powershell
-
Invoke-RestMethod itt.sh/ip
orirm itt.sh/ip
Depending on your setup, some tweaking is necessary in regards to TLS, redirects, and so on.
E-Mail hello @itta vern. com
Fediverse @itt@fosstodon.org
Twitter ITTavernCom
Matrix #lounge:matrix.ittavern.com
More reading:
- 13.03.2023 My Offsite Backup - March 2023
- 10.03.2023 Getting started with iperf3 - Network Troubleshooting
- 05.03.2023 ICMP echo requests on Linux and Windows - Reference Guide
- 14.02.2023 Simulate an unreliable network connection with tc and netem on Linux
- 08.02.2023 Detecting Rogue DHCP Server