I’m really new to Nginx so forgive me if this question seems obvious to
you.
I have Nginx with virtual hosts. In my nginx.conf I have
http {
…
include /etc/nginx/sites-enabled/*;
…
In /etc/nginx/sites-enabled/ I have my configuration such as default
server {
listen 80 default_server;
server_name _;
index index.html;
root /var/nginx/html;
access_log /var/log/nginx/default.access.log;
}
I would like all my virtual hosts to have some global properties such as
location = /favicon.ico {
return 204;
access_log off;
log_not_found off;
}
so that I won’t log access and errors relative to favicon.ico
But it’s not clear to me, where I should put this statement in order to
have a minimalistic configuration.
location is only available in server block. Though you could create a
file
with the location /favicon… and then include it in every server block
which will save you typing.
location is only available in server block. Though you could create a file
with the location /favicon… and then include it in every server block
which will save you typing.
I do this. I’m /sure/ I’ve seen some historic user-agents requesting
“favico.ico” or something like that, so I place it under a location of
just /favico.
Mik - you may find that a 204 is not what you want to return, as
browsers /may/ not cache such a 0-byte file for the favicon. I use
this, and include it in every server{} stanza:
I was wondering that since this “location” block (and probably other
settings) is going to be repeated in every one of my virtual hosts there
would be a was to configure this globally.
I don’t have any server stanza since I use include
/etc/nginx/sites-enabled/*;
I’ll do as Jonathan says except if someone has another suggestion.
Bye
I was wondering that since this “location” block (and probably other
settings) is going to be repeated in every one of my virtual hosts there
would be a was to configure this globally.
I don’t have any server stanza since I use include
/etc/nginx/sites-enabled/*;
I’ll do as Jonathan says except if someone has another suggestion.
Bye
This email (including any attachments) is confidential and may be
legally privileged. If you received this email in error, please delete
it immediately and do not copy it or use it for any purpose or disclose
its contents to any other person. Thank you.