diff --git a/docker/nginx.conf b/docker/nginx.conf index 00df8686..21a650bc 100644 --- a/docker/nginx.conf +++ b/docker/nginx.conf @@ -1,13 +1,41 @@ server { # HTTP on port 80 listen 80; + server_name happyhamster.org # This location references every path location / { + # Redirect http to https if the connection was made with http at the proxy level # https://serverfault.com/a/767930 if ($http_x_forwarded_proto = "http") { - return 301 https://$host$request_uri; + return 301 https://happyhamster.org$request_uri; + } + + # Path of the transpiled files to serve + root /usr/share/nginx/html; + + # Index file + # > Serve /index.html from / + index index.html; + + # Serve /index.html if the path is not found, + # because Angular is a single page application and resolves paths itselfs. + try_files $uri $uri/ /index.html =404; + } +} +server { + # HTTP on port 80 + listen 80; + server_name dev.happyhamster.org + + # This location references every path + location / { + + # Redirect http to https if the connection was made with http at the proxy level + # https://serverfault.com/a/767930 + if ($http_x_forwarded_proto = "http") { + return 301 https://dev.happyhamster.org$request_uri; } # Path of the transpiled files to serve