server { listen 80; listen [::]:80; #listen [::]:80 default_server ipv6only=on; server_name $DOMAIN; # Path to static files root /var/www/html/pathfinder/; index index.php index.html index.htm; # Specify a charset charset utf-8; # Logging =================================================================================================================== location = /setup { auth_basic "Setup Login"; auth_basic_user_file /etc/nginx/.setup_pass; try_files $uri $uri/ /index.php?$query_string; } location / { # First attempt to serve request as file, then # as directory, then fall back to index.php try_files $uri $uri/ /index.php?q=$uri&$args; } # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /var/lib/nginx/html; } # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; fastcgi_param SCRIPT_NAME $fastcgi_script_name; fastcgi_index index.php; include fastcgi_params; } location ~* \.(jpg|jpeg|gif|png|css|js|ico|xml)$ { expires 5d; } # deny access to . files, for security # location ~ /\. { log_not_found off; deny all; } location /ws/map/update { proxy_pass http://websocket; proxy_http_version 1.1; proxy_set_header Upgrade $http_upgrade; proxy_set_header Connection $connection_upgrade; proxy_set_header Host $host; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Host $host; proxy_set_header X-Forwarded-Port $server_port; proxy_set_header X-Forwarded-Proto $scheme; proxy_read_timeout 8h; proxy_send_timeout 5s; proxy_connect_timeout 3s; proxy_buffering off; } # static sources location /public/ { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 10s; sendfile_max_chunk 512k; } }