server { listen 6666; server_name domain.tld; root /var/www/mdblog; location / { try_files /html-pages$uri =404; } location /public { try_files $uri =404; } location ~ ^/raw/([a-z0-9]+)/(.+?)\.md { default_type text/plain; try_files /saved-files/$2.$1.md =404; } }