Skip to content

Instantly share code, notes, and snippets.

@ihrankouski
Forked from estebistec/README.md
Created October 2, 2019 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ihrankouski/b9f3375f9a50279a41fb8611de74f53d to your computer and use it in GitHub Desktop.
Save ihrankouski/b9f3375f9a50279a41fb8611de74f53d to your computer and use it in GitHub Desktop.
This minimal setup allows you to run nginx using the current folder as the doc-root. NOTE: python's simplehttpserver may be good enough for you. This is just a nice simple nginx setup.
  1. Get all of these files into the target folder
  2. Run the following commands:
chmod +x *.sh
./nginx-start.sh
#!/bin/sh
sed "s|SOURCE_ROOT|$(pwd)|" nginx.conf.template > nginx.conf
nginx -c $(pwd)/nginx.conf
echo "**** Access running server at http://localhost:8080 ****"
worker_rlimit_nofile 8192;
events {
worker_connections 4096;
}
http {
server {
listen 8080;
server_name localhost;
include /usr/local/etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
tcp_nopush on;
tcp_nodelay on;
access_log nginx-access.log;
error_log nginx-error.log;
location / {
root SOURCE_ROOT;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment