nginx setup

This commit is contained in:
ntr committed 2023-08-24 15:20:08 +10:00
1 parent 87ff6d072b
commit 579292460a
7 files changed
+62 -21

No files matched your search

View File
File renamed without changes.
+3 -3
View File
@@ -1,5 +1,5 @@
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
WORKDIR /App
WORKDIR /Server
# stops restore during build
COPY Server.csproj ./
@@ -10,6 +10,6 @@ RUN dotnet publish -c Release -o out
# Build runtime image
FROM mcr.microsoft.com/dotnet/aspnet:7.0
WORKDIR /App
COPY --from=build-env /App/out .
WORKDIR /Server
COPY --from=build-env /Server/out .
ENTRYPOINT ["dotnet", "Server.dll"]
View File
File renamed without changes.
@@ -12,5 +12,15 @@ services:
environment:
CONNECTIONSTRINGS__SPACERACE: "Server=pg;Port=5432;Database=${POSTGRES_DB};User Id=${POSTGRES_USER};Password=${POSTGRES_PASSWORD}"
build:
context: .
dockerfile: ./Dockerfile
context: ./Server
dockerfile: ./Server/Dockerfile
nginx:
image: nginx:latest
volumes:
- './nginx/spacerace.systems.nginx.conf:/etc/nginx/conf.d/default.conf'
- '/etc/letsencrypt:/etc/letsencrypt'
ports:
- '80:80'
- '443:443'
@@ -13,7 +13,7 @@ services:
environment:
CONNECTIONSTRINGS__SPACERACE: "Server=pg;Port=5432;Database=${POSTGRES_DB};User Id=${POSTGRES_USER};Password=${POSTGRES_PASSWORD}"
command: dotnet watch
working_dir: "/App"
working_dir: "/Server"
volumes:
- "./:/App"
- "./Server:/Server"
+45
View File
@@ -0,0 +1,45 @@
upstream spacerace_server {
server server:40080;
}
map $http_upgrade $connection_upgrade {
default upgrade;
'' close;
}
server {
server_name spacerace.systems;
gzip on;
gzip_vary on;
gzip_proxied any;
gzip_comp_level 6;
gzip_types text/plain text/css text/xml application/json application/javascript application/xml+rss application/atom+xml image/svg+xml;
# location / {
# root /srv/spacerace;
# index index.html;
# try_files $uri $uri/ index.html;
# }
location /api/ {
# trailing slash means api will receive url WITHOUT /api
proxy_pass http://spacerace_server/;
proxy_read_timeout 600s;
}
error_page 404 /;
listen [::]:443 ssl ipv6only=on; # managed by Certbot
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/spacerace.systems/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/spacerace.systems/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
# http -> https
server {
server_name spacerace.systems;
return 301 https://$host$request_uri;
}
-14
View File
@@ -1,14 +0,0 @@
1 2 3
-----------------
32.0 62.0
1337 1:18.8
32.0 62.0 -