Skip to content

Instantly share code, notes, and snippets.

@jemmanuel
Last active November 6, 2023 07:31
Show Gist options
  • Save jemmanuel/481bdac23690aa002c894cfc3a691b6f to your computer and use it in GitHub Desktop.
Save jemmanuel/481bdac23690aa002c894cfc3a691b6f to your computer and use it in GitHub Desktop.
Minimal nginx configuration for listing & serving static files from a predetermined directory
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;
}
}
}
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
}
}
}
@psycr0w13
Copy link

psycr0w13 commented Aug 28, 2018

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