http { include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; server { listen 8080; server_name codevoid.de; charset utf-8; location / { # index page if ($args = "") { rewrite ^/$ /?q=gopher://codevoid.de last; } # smiley support if ( $args ~ "^☺=(.*)") { set $arg $1; rewrite ^/.*$ /?q=$arg last; } if ( $args ~ "^%E2%98%BA=(.*)") { set $arg $1; rewrite ^/.*$ /?q=$arg last; } # shortcuts if ($arg_q = "gpg") { rewrite ^/.*$ /?q=/0/pubkey.gpg last; } if ($arg_q = "stats") { rewrite ^/.*$ /?q=/1/stats last; } if ($arg_q = "twtxt") { rewrite ^/.*$ /?q=/0/tw.txt last; } if ($arg_q !~ "^(gopher|/|%)") { return 307 https://duckduckgo.com/html?q=$arg_q; } include fastcgi_params; fastcgi_param SCRIPT_NAME /gopherproxy; fastcgi_param REQUEST_URI /gopherproxy; fastcgi_pass unix:/var/run/slowcgi.sock; } error_page 500 502 503 504 /50x.html; location = /50x.html { root /usr/local/www/nginx-dist; } } }