Last active
February 29, 2024 06:41
-
-
Save syedmhashim/86afb7ef7a10a1e15dbc481c0cdd1adf to your computer and use it in GitHub Desktop.
Serve static build using nginx
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
version: '3.1' | |
services: | |
web: | |
image: nginx | |
volumes: | |
- $PWD:/usr/share/nginx/html | |
- $HOME/mystuff/docker/nginx/nginx.conf:/etc/nginx/nginx.conf | |
ports: | |
- "8080:80" |
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
events { | |
worker_connections 1024; | |
} | |
http{ | |
server { | |
listen 80; | |
server_name localhost; | |
location / { | |
root /usr/share/nginx/html; | |
index index.html index.htm; | |
try_files $uri /index.html; | |
} | |
error_page 500 502 503 504 /50x.html; | |
location = /50x.html { | |
root /usr/share/nginx/html; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add the following function to
.zshrc
or.bashrc
file:Now you can run
website-up
command in any directory to serve it on localhost:8080.