map $http_accept_language $lang {
	default en;
	~fr fr;
}

server {
    listen 80;
    server_name _;

    root /usr/share/nginx/html;
    index index.html;

    # Redirect users to their language home page
    rewrite ^/$ /$lang/ redirect;

    location / {
        try_files $uri $uri/ =404;
    }

    # Custom 404 page
    error_page 404 /$lang/404.html;
    location = /$lang/404.html {
        internal;
    }
}

