Skip to content

Instantly share code, notes, and snippets.

@tcyrus
Last active June 6, 2019 19:40
Show Gist options
  • Select an option

  • Save tcyrus/803b10824aab6b987b629ae2a9e1edab to your computer and use it in GitHub Desktop.

Select an option

Save tcyrus/803b10824aab6b987b629ae2a9e1edab to your computer and use it in GitHub Desktop.
nginx config for my MOTD sites (who needs a status page when you can have a dummy page)
server {
listen 80;
listen [::]:80;
server_name paff.tcyr.us;
access_log off;
error_log off;
return 301 https://$host$request_uri;
}
server {
# SSL configuration
listen 443 ssl http2;
listen [::]:443 ssl http2;
include snippets/letsencrypt.conf;
root /srv/www/motd;
index index.html index.htm;
server_name paff.tcyr.us;
location / {
if ($http_user_agent ~ curl) {
rewrite ^/$ /motd.txt last;
}
# First attempt to serve request as file, then
# as directory, then fall back to displaying a 404.
try_files $uri $uri/ =404;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment