Use a simpler nginx.conf in dev

This commit is contained in:
Catalin Constantin Mititiuc 2025-06-16 20:18:05 -07:00
parent b7ee091288
commit 070bac262f
2 changed files with 36 additions and 2 deletions

View File

@ -1,13 +1,14 @@
image = miti.sh image = miti.sh
run: run:
docker run --rm -it --init -v $(PWD):/opt/app -p 8080:80 $(image) docker run --rm -it --init -v $(PWD):/opt/app -p 8080:80 $(image) \
sh -c "openresty -p /opt/app -g 'daemon off;' -c conf/dev.nginx.conf"
build: build:
docker run --rm -w /opt/app -v $(PWD):/opt/app $(image) sitegen docker run --rm -w /opt/app -v $(PWD):/opt/app $(image) sitegen
image-rm: image-rm:
docker image rm $(image):latest docker image rm $(image)
image-build: image-build:
docker build -t $(image) . docker build -t $(image) .

33
conf/dev.nginx.conf Normal file
View File

@ -0,0 +1,33 @@
worker_processes 1;
error_log logs/error.log;
events {
worker_connections 1024;
}
http {
server {
listen 80;
include mime.types;
charset utf-8;
default_type text/html;
try_files $uri $uri/ $uri.html =404;
# return `/posts/index.html` from `/posts`
location = /posts {
rewrite ^ /posts/ break;
}
# redirect requests ending in a forward slash
location ~ ^/(.+)/$ {
return 301 /$1;
}
location /css {
expires 1h;
alias css;
}
}
}