Last active
November 6, 2023 07:31
-
-
Save jemmanuel/481bdac23690aa002c894cfc3a691b6f to your computer and use it in GitHub Desktop.
Minimal nginx configuration for listing & serving static files from a predetermined directory
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
events { | |
} | |
http { | |
# default set of files and their content types | |
include mime.types; | |
# prompt user for download for any undeclared file format | |
default_type application/octet-stream; | |
# optimization when serving static files | |
sendfile on; | |
server { | |
# no need for root privileges | |
listen 8080; | |
server_name localhost | |
location / { | |
# insert desired path here | |
root /Users/jemmanuel/share | |
# this directive enables directory listing | |
autoindex on; | |
} | |
} | |
} |
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
events { | |
} | |
http { | |
# default set of files and their content types | |
include mime.types; | |
# prompt user for download for any undeclared file format | |
default_type application/octet-stream; | |
# optimization when serving static files | |
sendfile on; | |
server { | |
# no need for root privileges | |
listen 8080; | |
server_name localhost | |
location / { | |
# insert desired path here | |
root /Users/jemmanuel/share | |
} | |
} | |
} |
server_name localhost misses a ; too
Both files
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
root /Users/jemmanuel/share
;
miss a
;