Skip to content

Instantly share code, notes, and snippets.

@se7enack
Created June 25, 2024 14:36
Show Gist options
  • Save se7enack/6b4db87fcf94cd4b8815bdf77ea30ddf to your computer and use it in GitHub Desktop.
Save se7enack/6b4db87fcf94cd4b8815bdf77ea30ddf to your computer and use it in GitHub Desktop.
ipify clone
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log notice;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
include /etc/nginx/conf.d/*.conf;
server {
listen 80 default_server;
server_name ipv4check.getburke.com;
real_ip_header X-Forwarded-For;
set_real_ip_from 192.168.0.0/16;
location / {
default_type text/plain;
if ($args ~ format=xml) {
return 200 "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n<ip>$remote_addr</ip>";
}
if ($args ~ format=yaml) {
return 200 "---\nip: $remote_addr\n";
}
if ($args ~ format=json) {
return 200 "{\"ip\":\"$remote_addr\"}";
}
return 200 "$remote_addr\n";
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment