server { listen 80; server_name _; ## # `gzip` Settings # https://www.digitalocean.com/community/tutorials/how-to-improve-website-performance-using-gzip-and-nginx-on-ubuntu-20-04 gzip on; gzip_disable "msie6"; gzip_vary on; gzip_proxied any; gzip_comp_level 6; gzip_buffers 16 8k; gzip_http_version 1.1; gzip_min_length 256; gzip_types application/atom+xml application/geo+json application/javascript application/x-javascript application/json application/ld+json application/manifest+json application/rdf+xml application/rss+xml application/xhtml+xml application/xml font/eot font/otf font/ttf font/woff2 image/svg+xml text/css text/javascript text/plain text/xml; # Redirects all `/` requests to `/portal/` using the `$http_x_forwarded_proto` header for protocol location / { rewrite ^/(.*)$ $http_x_forwarded_proto://$http_host/portal/$1 permanent; } # Maps `/portal/` to the directory `/usr/share/nginx/html/` location ^~ /portal/ { alias /usr/share/nginx/html/; index index.html index.htm; # try_files $uri $uri/ /index.html =404; } # Matches `/portal` exactly and redirects to `/portal/` for a consistent URL structure location = /portal { rewrite ^/(.*)$ $http_x_forwarded_proto://$http_host/portal/ permanent; } location = /nginx-health { access_log off; return 200 "healthy\n"; } # error_page 500 502 503 504 /50x.html; # location = /50x.html { # root /usr/share/nginx/html; # } }