Skip to content

Instantly share code, notes, and snippets.

@soreana
Last active May 13, 2021 23:35
Show Gist options
  • Save soreana/f9055204db4cc4634f3e095928422a77 to your computer and use it in GitHub Desktop.
Save soreana/f9055204db4cc4634f3e095928422a77 to your computer and use it in GitHub Desktop.
Handy nginx docker server
# Run below command to start new nginx docker container which hosted files in /home/asa/downloads/ directory on http://<Host IP>:8090
# Keep in mind that this file (nginx.conf) should be in `/home/asa/desktop/nginx/` directory.
# `docker run --name nginx -p 8080:80 -v $HOME/downloads/:/usr/share/nginx/html/:ro -v $HOME/desktop/nginx/nginx.conf:/etc/nginx/nginx.conf:ro -d --rm nginx`
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
server {
listen 0.0.0.0:80;
location / {
# index index.html; uncomment if you want to host static site.
autoindex on; # Let clients see directories.
root /usr/share/nginx/html/;
}
}
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
#tcp_nopush on;
keepalive_timeout 65;
#gzip on;
include /etc/nginx/conf.d/*.conf;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment