Last active
June 6, 2019 19:40
-
-
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)
This file contains hidden or 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
| 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