Last active
August 31, 2022 09:07
-
-
Save cnotv/04c4dceebee6521934f6d7985f08688a to your computer and use it in GitHub Desktop.
Nginx explained
This file contains hidden or 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
# Full guide: http://nginx.org/en/docs/beginners_guide.html | |
# Configuration is located in etc/nginx/sites-available/default | |
# NOTE: Updates will require `nginx -s reload` in order to be adopted | |
# Following configurations are within the "main" context | |
# Block directive with fixed values, more at: https://docs.nginx.com/nginx/admin-guide/basic-functionality/managing-configuration-files/ | |
http { | |
# Context of the block directive within brackets {} | |
# Anything defined and is not a block is a directive and ends with semicolon ; | |
server { | |
# Map any request to specified port and apply following rules | |
listen 8080; | |
# Specified path directives, in this case for root | |
# Higher specification have priority and not the definition order | |
location / { | |
# Redirect request to specific port | |
proxy_pass http://localhost:8080; | |
} | |
# Custom path | |
location /anything { | |
# Map to path to load folder, default index.html | |
root /data/www; | |
} | |
# Path by RegEx prefixed with ~ | |
location ~ \.(gif|jpg|png)$ {} | |
} | |
} | |
events { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment