-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from MattHalloran/dev
Self-cert SSL for local https
- Loading branch information
Showing
9 changed files
with
415 additions
and
150 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Ignore mkcert generated files (certificates and keys) | ||
certs/ | ||
localhost+*.pem |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
version: '3.8' | ||
|
||
services: | ||
nginx-local: | ||
image: nginx:latest | ||
container_name: nginx-local-dev | ||
ports: | ||
- "80:80" | ||
- "443:443" | ||
volumes: | ||
- ./nginx/conf.d/local.conf:/etc/nginx/conf.d/local.conf:ro | ||
- ./certs/localhost+2.pem:/etc/nginx/certs/localhost+2.pem | ||
- ./certs/localhost+2-key.pem:/etc/nginx/certs/localhost+2-key.pem | ||
# Remove default config | ||
- /dev/null:/etc/nginx/conf.d/default.conf:ro | ||
networks: | ||
- proxy | ||
|
||
networks: | ||
proxy: | ||
name: nginx-proxy | ||
external: true |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
client_max_body_size 100m; | ||
|
||
resolver 127.0.0.11 valid=30s; | ||
|
||
# Enable HTTP/2 globally | ||
http2 on; | ||
|
||
server { | ||
listen 80; | ||
listen [::]:80; | ||
server_name localhost; | ||
|
||
# Redirect HTTP to HTTPS | ||
location / { | ||
return 301 https://$host$request_uri; | ||
} | ||
} | ||
|
||
server { | ||
listen 443 ssl; | ||
listen [::]:443 ssl; | ||
server_name localhost; | ||
|
||
ssl_certificate /etc/nginx/certs/localhost+2.pem; | ||
ssl_certificate_key /etc/nginx/certs/localhost+2-key.pem; | ||
|
||
ssl_session_cache shared:SSL:1m; | ||
ssl_session_timeout 10m; | ||
ssl_ciphers HIGH:!aNULL:!MD5; | ||
ssl_prefer_server_ciphers on; | ||
|
||
# Use variables to defer DNS resolution | ||
set $ui_upstream ui:3000; # Change to match your UI server's name and port | ||
set $api_upstream server:5329; # Change to match your API server's name and port | ||
|
||
# UI Server Proxy | ||
location / { | ||
# proxy_pass http://$ui_upstream; | ||
# proxy_set_header Host $host; | ||
# proxy_set_header X-Real-IP $remote_addr; | ||
# proxy_http_version 1.1; | ||
# proxy_set_header Connection ""; | ||
# proxy_buffering off; # For WebSocket support | ||
# proxy_request_buffering off; | ||
proxy_pass http://$ui_upstream; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; | ||
proxy_set_header X-Forwarded-Proto $scheme; | ||
} | ||
|
||
# API Server Proxy | ||
location /api/ { | ||
proxy_pass http://$api_upstream; | ||
proxy_set_header Host $host; | ||
proxy_set_header X-Real-IP $remote_addr; | ||
proxy_http_version 1.1; | ||
proxy_set_header Connection ""; | ||
} | ||
|
||
# Support for WebSocket connections | ||
location /sockjs-node { | ||
proxy_pass http://$ui_upstream/sockjs-node; | ||
proxy_http_version 1.1; | ||
proxy_set_header Upgrade $http_upgrade; | ||
proxy_set_header Connection "Upgrade"; | ||
} | ||
} |
File renamed without changes.
Oops, something went wrong.