React-router and nginx

The location block in your nginx config should be: location / { try_files $uri /index.html; } The problem is that requests to the index.html file work, but you’re not currently telling nginx to forward other requests to the index.html file too.

Nginx serves .php files as downloads, instead of executing them

Try this: Edit /etc/nginx/sites-available/default Uncomment both listen lines to make Nginx listen on port 80 IPv4 and IPv6. listen 80; ## listen for ipv4; this line is default and implied listen [::]:80 default_server ipv6only=on; ## listen for ipv6 Leave server_name alone # Make site accessible (…) server_name localhost; Add index.php to the index line root … Read more

NGINX: upstream timed out (110: Connection timed out) while reading response header from upstream

This happens because your upstream takes too long to answer the request and NGINX thinks the upstream already failed in processing the request, so it responds with an error. Just include and increase proxy_read_timeout in location config block. Same thing happened to me and I used 1 hour timeout for an internal app at work: … Read more

Have nginx access_log and error_log log to STDOUT and STDERR of master process

Edit: it seems nginx now supports error_log stderr; as mentioned in Anon’s answer. You can send the logs to /dev/stdout. In nginx.conf: daemon off; error_log /dev/stdout info; http { access_log /dev/stdout; … } edit: May need to run ln -sf /proc/self/fd /dev/ if using running certain docker containers, then use /dev/fd/1 or /dev/fd/2

How can I tell if my server is serving GZipped content?

It looks like one possible answer is, unsurprisingly, curl: $ curl http://example.com/ –silent –write-out “%{size_download}\n” –output /dev/null 31032 $ curl http://example.com/ –silent -H “Accept-Encoding: gzip,deflate” –write-out “%{size_download}\n” –output /dev/null 2553 In the second case the client tells the server that it supports content encoding and you can see that the response was indeed shorter, compressed.

What does upstream mean in nginx?

It’s used for proxying requests to other servers. An example from http://wiki.nginx.org/LoadBalanceExample is: http { upstream myproject { server 127.0.0.1:8000 weight=3; server 127.0.0.1:8001; server 127.0.0.1:8002; server 127.0.0.1:8003; } server { listen 80; server_name www.domain.com; location / { proxy_pass http://myproject; } } } This means all requests for / go to the any of the servers … Read more

How do I prevent a Gateway Timeout with FastCGI on Nginx

Proxy timeouts are well, for proxies, not for FastCGI… The directives that affect FastCGI timeouts are client_header_timeout, client_body_timeout and send_timeout. Edit: Considering what’s found on nginx wiki, the send_timeout directive is responsible for setting general timeout of response (which was bit misleading). For FastCGI there’s fastcgi_read_timeout which is affecting the FastCGI process response timeout.

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)