nginx setup
This commit is contained in:
1 parent
cc0a86820d
commit
1495ca49ea
7 files changed
+62
-21
No files matched your search
File renamed without changes.
+3
-3
@@ -1,5 +1,5 @@
|
|||||||
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
|
FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build-env
|
||||||
WORKDIR /App
|
WORKDIR /Server
|
||||||
|
|
||||||
# stops restore during build
|
# stops restore during build
|
||||||
COPY Server.csproj ./
|
COPY Server.csproj ./
|
||||||
@@ -10,6 +10,6 @@ RUN dotnet publish -c Release -o out
|
|||||||
|
|
||||||
# Build runtime image
|
# Build runtime image
|
||||||
FROM mcr.microsoft.com/dotnet/aspnet:7.0
|
FROM mcr.microsoft.com/dotnet/aspnet:7.0
|
||||||
WORKDIR /App
|
WORKDIR /Server
|
||||||
COPY --from=build-env /App/out .
|
COPY --from=build-env /Server/out .
|
||||||
ENTRYPOINT ["dotnet", "Server.dll"]
|
ENTRYPOINT ["dotnet", "Server.dll"]
|
||||||
File renamed without changes.
@@ -12,5 +12,15 @@ services:
|
|||||||
environment:
|
environment:
|
||||||
CONNECTIONSTRINGS__SPACERACE: "Server=pg;Port=5432;Database=${POSTGRES_DB};User Id=${POSTGRES_USER};Password=${POSTGRES_PASSWORD}"
|
CONNECTIONSTRINGS__SPACERACE: "Server=pg;Port=5432;Database=${POSTGRES_DB};User Id=${POSTGRES_USER};Password=${POSTGRES_PASSWORD}"
|
||||||
build:
|
build:
|
||||||
context: .
|
context: ./Server
|
||||||
dockerfile: ./Dockerfile
|
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:
|
environment:
|
||||||
CONNECTIONSTRINGS__SPACERACE: "Server=pg;Port=5432;Database=${POSTGRES_DB};User Id=${POSTGRES_USER};Password=${POSTGRES_PASSWORD}"
|
CONNECTIONSTRINGS__SPACERACE: "Server=pg;Port=5432;Database=${POSTGRES_DB};User Id=${POSTGRES_USER};Password=${POSTGRES_PASSWORD}"
|
||||||
command: dotnet watch
|
command: dotnet watch
|
||||||
working_dir: "/App"
|
working_dir: "/Server"
|
||||||
volumes:
|
volumes:
|
||||||
- "./:/App"
|
- "./Server:/Server"
|
||||||
|
|
||||||
@@ -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;
|
||||||
|
}
|
||||||
Reference in new issue
Block a user