88 lines
2.1 KiB
Nginx Configuration File
88 lines
2.1 KiB
Nginx Configuration File
events {
|
|
worker_connections 1024;
|
|
}
|
|
|
|
http {
|
|
include /etc/nginx/mime.types;
|
|
default_type application/octet-stream;
|
|
sendfile on;
|
|
server_tokens off;
|
|
|
|
log_format workshop '$remote_addr - $request '
|
|
'status=$status upstream=$upstream_addr '
|
|
'rt=$request_time urt=$upstream_response_time';
|
|
|
|
access_log /var/log/nginx/access.log workshop;
|
|
|
|
upstream backend_a {
|
|
server backend-a:80;
|
|
server backend-a2:80;
|
|
}
|
|
|
|
upstream backend_b {
|
|
server backend-b:80;
|
|
}
|
|
|
|
upstream backend_c {
|
|
server backend-c:80;
|
|
}
|
|
|
|
server {
|
|
listen 80;
|
|
server_name _;
|
|
|
|
add_header X-Content-Type-Options "nosniff" always;
|
|
add_header X-Frame-Options "DENY" always;
|
|
add_header Referrer-Policy "strict-origin-when-cross-origin" always;
|
|
add_header Permissions-Policy "camera=(), microphone=(), geolocation=()" always;
|
|
add_header Cross-Origin-Opener-Policy "same-origin" always;
|
|
add_header Cross-Origin-Resource-Policy "same-origin" always;
|
|
|
|
location / {
|
|
root /usr/share/nginx/html;
|
|
try_files $uri $uri/ /index.html;
|
|
}
|
|
|
|
location = /service/a {
|
|
proxy_pass http://backend_a/;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-Proto http;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
location = /demo/a {
|
|
proxy_pass http://backend_a/;
|
|
}
|
|
|
|
location = /service/b {
|
|
proxy_pass http://backend_b/;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-Proto http;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
location = /service/c {
|
|
proxy_pass http://backend_c/;
|
|
proxy_set_header Host $host;
|
|
proxy_set_header X-Forwarded-Proto http;
|
|
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
}
|
|
|
|
location = /healthz {
|
|
default_type text/plain;
|
|
return 200 "ok\n";
|
|
}
|
|
|
|
location = /internal/status {
|
|
access_log off;
|
|
default_type text/plain;
|
|
|
|
if ($remote_addr != 127.0.0.1) {
|
|
return 403;
|
|
}
|
|
|
|
return 200 "internal ok\n";
|
|
}
|
|
}
|
|
}
|