-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnginx.conf
More file actions
67 lines (56 loc) · 2.18 KB
/
Copy pathnginx.conf
File metadata and controls
67 lines (56 loc) · 2.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
worker_processes 1;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
# Redirect all HTTP traffic to HTTPS
server {
listen 80;
server_name jmelzacki.com www.jmelzacki.com;
# Redirect to HTTPS
return 301 https://$host$request_uri;
}
# SSL Configuration for HTTPS Traffic
server {
listen 443 ssl;
server_name jmelzacki.com www.jmelzacki.com;
# SSL certificate and key
ssl_certificate /etc/ssl/certs/jmelzacki_com.crt;
ssl_certificate_key /etc/ssl/certs/jmelzacki.com.key;
ssl_trusted_certificate /etc/ssl/certs/jmelzacki_com.ca-bundle;
# SSL protocols and ciphers
ssl_protocols TLSv1.2 TLSv1.3;
ssl_prefer_server_ciphers on;
ssl_ciphers HIGH:!aNULL:!MD5;
# Add Content-Security-Policy header
add_header Content-Security-Policy "
default-src 'self';
script-src 'self' https://unpkg.com https://*.consent.cookiebot.com 'unsafe-inline';
style-src 'self' 'unsafe-inline' https://unpkg.com https://*.googleapis.com;
img-src 'self' data: https://*.google.com https://pagead2.googlesyndication.com;
font-src 'self' https://fonts.googleapis.com https://fonts.gstatic.com;
connect-src 'self' https://api.your-api.com;
" always;
# Proxy API requests to backend service on port 8080
location /api/ {
rewrite ^/api/(.*)$ /$1 break;
proxy_pass http://backend:8080;
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;
}
# Serve the Vue.js frontend application
location / {
proxy_pass http://frontend:80;
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;
}
}
}