feat: redirect should work

This commit is contained in:
Pavel Korytov 2021-12-11 20:58:21 +03:00
parent 0edb77b03d
commit f9dc1515ec
3 changed files with 23 additions and 2 deletions

View file

@ -3,6 +3,7 @@ RUN apt-get update && apt-get install -y python3 python3-pip git
RUN pip install flask python-dotenv flask_httpauth gunicorn
COPY . /usr/share/nginx/html
RUN mv /usr/share/nginx/html/deploy /
RUN (cd /usr/share/nginx/html && git remote set-url origin https://github.com/SqrtMinusOne/sqrtminusone.github.io.git)
RUN (cd /usr/share/nginx/html && git remote set-url origin https://github.com/SqrtMinusOne/sqrtminusone.github.io.git && git reset origin/master --hard)
RUN rm /usr/share/nginx/html/index.html
RUN mv /deploy/default.conf /etc/nginx/conf.d/default.conf
CMD bash /deploy/entrypoint.sh

20
deploy/default.conf Normal file
View file

@ -0,0 +1,20 @@
server {
listen 8080;
server_name sqrtminusone.xyz;
root /usr/share/nginx/html;
location / {
try_files $uri @redirect;
}
location @redirect {
if ($uri ~* ^(.+)/$) { rewrite ^ $uri/index.html last; }
if (-d $document_root$uri) { return $scheme://$host:8080$uri/; }
return 404;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/html;
}
}

View file

@ -5,5 +5,5 @@ services:
container_name: "sqrtminusone.xyz"
build: .
ports:
- 8080:80
- 8080:8080
- 8081:8000