27 lines
863 B
Nginx Configuration File
27 lines
863 B
Nginx Configuration File
server {
|
|
listen 80;
|
|
server_name localhost;
|
|
root /static-files;
|
|
|
|
if ($request_method = 'OPTIONS') {
|
|
add_header Access-Control-Allow-Origin "*" always;
|
|
add_header Access-Control-Allow-Methods "GET, OPTIONS" always;
|
|
add_header Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization" always;
|
|
return 204;
|
|
}
|
|
|
|
# Only serve markdown files
|
|
location ~* \.md$ {
|
|
try_files $uri =404;
|
|
add_header Content-Type "text/markdown; charset=utf-8" always;
|
|
add_header Access-Control-Allow-Origin "*" always;
|
|
add_header Access-Control-Allow-Methods "GET, Options" always;
|
|
add_header Access-Control-Allow-Headers "Origin, Content-Type, Accept, Authorization" always;
|
|
}
|
|
|
|
# Return 404 for everything else
|
|
location / {
|
|
return 404;
|
|
}
|
|
}
|