Hot answers tagged

3

In your config first server block is the default_server which will be used for all requests that don't match a more specific server. Rather than return 301 https://www.$host$request_uri; in the default_server don't use the Host header from the request as a parameter to generate the redirect, as that can become all kinds of incorrect things, instead use ...


2

The specification of a location in the first example indicates that you might have locations or paths that should not be redirected to the HTTPS listener, for some reason. The second example should take all traffic to the given hostname and redirect it.


1

Every ssl virtualhost must define key/cert. So in your case if you wrote "listen ... ssl", you have to write ssl_certificate lines. It is not important, if that key/cert pair will be used for anything else. You can have aliases. I.e. if your key/cert pair in /etc/letsencrypt/live/example.com is valid for both example.com and www.example.com (i.e. that is ...


1

This is quite tricky because the $status variable is empty when declaring the limit_req_zone. The $status is only known after nginx has processed the request. For example after a proxy_pass directive. The closest I could get to achieve rate limiting by status is doing the following: ... ... ... limit_req_zone $binary_remote_addr zone=api:10m rate=5r/s; ... ...


1

It's not a command, it's a directive that should be put in your nginx.conf. As per documentation: in Nginx you need to add several lines to your nginx.conf. In every server block where PageSpeed is enabled add: pagespeed on; It's a snippet from the configuration file. The same goes for other directives such as pagespeed rewrite_images on


1

try_files is used to refer to physical files on the filesystem. With your configuration, when requesting /login/?param1=value1, nginx tries to find file /var/www/app_one/dist/login/param1=value1. Depending on the actual contents of param1 and value1, nginx might respond with 400 Bad request, because some characters are not allowed when accessing files.


1

According to the comments below your question, the initial problem was that your code captured the file extension of a requested image, and searched for a file which file name was made up of the file extension and the trailing webp suffix, for example jpg.webp. -- Regarding how to serve either image.webp or image.jpg etc: Populate the variables which are ...


Only top voted, non community-wiki answers of a minimum length are eligible