Skip to content

Instantly share code, notes, and snippets.

@therebelrobot
Last active April 21, 2021 06:00
Show Gist options
  • Save therebelrobot/ed53c4ae2435d4c12fcc64f0b03001b9 to your computer and use it in GitHub Desktop.
Save therebelrobot/ed53c4ae2435d4c12fcc64f0b03001b9 to your computer and use it in GitHub Desktop.
Infra Basics: What is a web server?
nginx -p `pwd`/ -c nginx.conf
worker_processes 1;
daemon off;
# ^ this ensures your server stays attached to your terminal
# you don't want this normally
error_log /dev/stdout info;
# ^ this attaches errors to stderr, also not normally wanted
events {
worker_connections 1024;
}
http {
access_log /dev/stdout;
# ^ this attaches access logs to stdout, also not wanted normally
server {
listen 80 default_server;
root .;
index index.html;
server_name hellonode;
location ^~ /img/ {
gzip on;
expires 12h;
add_header Cache-Control public;
}
location / {
proxy_http_version 1.1;
proxy_cache_bypass $http_upgrade;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_pass http://localhost:5555;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment