A bit down on this nginx config reference page you'll see:
rewrite ^ http://example.com$request_uri? permanent;
What is the meaning of ^
above?
Through a simple command you can verify the status of the Nginx configuration file: $ sudo systemctl config nginx The output will show if the configuration file is correct or, if it is not, it will show the file and the line where the problem is.
By default, the configuration file is named nginx. conf and placed in the directory /usr/local/nginx/conf , /etc/nginx , or /usr/local/etc/nginx .
Nginx uses an event-based connection processing model, so the directives defined within this context determine how worker processes should handle connections. Mainly, directives found here are used to either select the connection processing technique to use, or to modify the way these methods are implemented.
The location directive within NGINX server block allows to route request to correct location within the file system. The directive is used to tell NGINX where to look for a resource by including files and folders while matching a location block against an URL.
For rewrite, the first argument is the match pattern and only applies to the path portion of the url, not the domain. In regular expressions, ^
matches the beginning of the input. For example, ^/photos/.*$
would match paths beginning in '/photos/'. By itself, ^
is a shortcut for all paths (since they all have a beginning).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With