server { listen 80 default_server; server_name ~^(?.*?)-(?.*?)\.(?.*); root /usr/share/cybafelo/$app; location ~ \.php$ { fastcgi_pass php; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_URL $request_uri; fastcgi_param SERVER_NAME $http_host; include fastcgi_params; } location = / { add_header Access-Control-Allow-Origin $http_origin; try_files /index.html @node; } location ~ { add_header Access-Control-Allow-Origin $http_origin; try_files $uri dist/$uri @node; } location @node { # WebSocket support proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection "upgrade"; # Normal parameters proxy_pass_request_headers on; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header X-NginX-Proxy true; # Set Environment, App, and Domain proxy_set_header X-Gamewheel-Env $environment; proxy_set_header X-Gamewheel-App $app; proxy_set_header X-Gamewheel-Host $host_domain; # Pass Everything to our app proxy_pass http://$app; proxy_ssl_session_reuse off; proxy_set_header Host $http_host; proxy_redirect off; } }