Nginx is simple to use, yet a powerful web server. If you'd like to search through its official documentation for a term that you couldn't understand or just wanted to learn the syntax of a keyword, you don't have to search through the entire Nginx documentation site. Instead, you could use the shortcut https://nginx.org/r/keyword . … Continue reading Documentation Shortcuts in Nginx
Category: Nginx
nginx: [emerg] unexpected end of file, expecting “;” or “}” in filename:linenumber
I created a new vhost for a domain to serve static files. Here's the config... server { server_name static.example.com; root "/path/to/static.example.com/public; index index.html; access_log /var/log/nginx/static.example.com-access.log; error_log /var/log/nginx/static.example.com-error.log; location / { try_files $uri $uri/ /index.html; } } It can't get simpler than this. However, when I checked the configuration with `nginx -t`, it threw the … Continue reading nginx: [emerg] unexpected end of file, expecting “;” or “}” in filename:linenumber
Correct Nginx try_files syntax with query params
With WordPress sites and Nginx servers, you may have used one of the following try_files directives... try_files $uri $uri/ /index.php; try_files $uri $uri/ /index.php?$args; Both are incomplete. With the first method, arguments are not passed. With the second method, question mark is present, even when there are no query parameters. A complete solution is to … Continue reading Correct Nginx try_files syntax with query params
SSL -> Nginx -> Varnish Infinite Redirect
Add the following code, when you use SSL => Nginx => Varnish stack and if you experience infinite redirect...
nginx error: (99: Cannot assign requested address)
Ref: http://stackoverflow.com/a/13141104/1004587 With Amazon EC2 and elastic IPs, the server doesn't actually know its IP as with most any other server. So you need to tell your linux to allow processes to bind to the non-local address. Just add the following line into /etc/sysctl.conf file: and then reload your sysctl.conf by: which will be fine on reboots.