Last active
April 21, 2021 06:00
-
-
Save therebelrobot/ed53c4ae2435d4c12fcc64f0b03001b9 to your computer and use it in GitHub Desktop.
Infra Basics: What is a web server?
This file contains 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
nginx -p `pwd`/ -c nginx.conf |
This file contains 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
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