Welcome! Log In Create A New Profile

Advanced

Re: Nginx rewrite rule for favicon.ico files

August 31, 2012 10:02AM
On Fri, Aug 31, 2012 at 09:52:48AM -0400, nexon wrote:
> Igor Sysoev Wrote:
> -------------------------------------------------------
> > On Aug 31, 2012, at 15:44 , nexon wrote:
> >
> > >> Anything except favicons in this servers is the same ?
> > >
> > > Please explain your question.
> > > If I understand you correctly, you are asking is every subdomain
> > have their
> > > own page, than yes.
> > > The trick is that if subdomain have it's own favicon than it needs
> > to be
> > > served with it, if not, than to be served with main favicon.ico...
> >
> > The question is why do you try to push everything inside one server
> > instead of separating processing in several servers:
> >
> > server {
> > server_name sub1.domain.com;
> > ...
> > }
> >
> > server {
> > server_name sub2.domain.com;
> > ...
> > }
> >
> > server {
> > server_name sub3.domain.com;
> > ...
> > }
>
> I am using several vhosts and this is part of the setup file for one of
> them:
>
> server_name sub1.example.com *.domain.com domain.com sub2.example.com;
>
> if ($host = something1.domain.com){
> rewrite ^/favicon.ico$ /favicon_domain.com.ico break;
> }
>
> if ($host = something2.domain.com){
> rewrite ^/favicon.ico$ /favicon_domain.com.ico break;
> }
>
> etc...
>
> I plan to put all *.ico files in location /images/
>
> something1.domain.com.ico
> something2.domain.com.ico
> something3.domain.com.ico
>
> etc...
>
> So what I need is:
> when request is for something1.domain.com.ico happens
> than to check in location /images/ is there a file something1.domain.com.ico
> and serve it if it is there,
> but if there is no such a file, than to serve clasic favicon.ico file.

server {
server_name something1.domain.com;

location = /favicon.ico {
alias /image/something1.domain.com.ico;
}

...
}

server {
server_name something2.domain.com;

location = /favicon.ico {
alias /image/something2.domain.com.ico;
}

...
}

server {
server_name something3.domain.com;

location = /favicon.ico {
alias /image/something3.domain.com.ico;
}

...
}


--
Igor Sysoev

_______________________________________________
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx
Subject Author Posted

Nginx rewrite rule for favicon.ico files

nexon August 31, 2012 06:28AM

Re: Nginx rewrite rule for favicon.ico files

Igor Sysoev August 31, 2012 06:44AM

Re: Nginx rewrite rule for favicon.ico files

nexon August 31, 2012 07:27AM

Re: Nginx rewrite rule for favicon.ico files

Igor Sysoev August 31, 2012 07:34AM

Re: Nginx rewrite rule for favicon.ico files

nexon August 31, 2012 07:44AM

Re: Nginx rewrite rule for favicon.ico files

Igor Sysoev August 31, 2012 08:30AM

Re: Nginx rewrite rule for favicon.ico files

nexon August 31, 2012 09:10AM

Re: Nginx rewrite rule for favicon.ico files

Igor Sysoev August 31, 2012 10:02AM

Re: Nginx rewrite rule for favicon.ico files

nexon August 31, 2012 10:50AM

Re: Nginx rewrite rule for favicon.ico files

Igor Sysoev August 31, 2012 10:58AM

Re: Nginx rewrite rule for favicon.ico files

Reinis Rozitis August 31, 2012 06:56AM

Re: Nginx rewrite rule for favicon.ico files

nexon August 31, 2012 09:13AM

Re: Nginx rewrite rule for favicon.ico files

VBart August 31, 2012 09:20AM

Re: Nginx rewrite rule for favicon.ico files

nexon August 31, 2012 10:52AM

Re: Nginx rewrite rule for favicon.ico files

Mark Alan August 31, 2012 09:16AM

Re: Nginx rewrite rule for favicon.ico files

nexon August 31, 2012 09:31AM

Re: Nginx rewrite rule for favicon.ico files

nexon August 31, 2012 10:54AM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 232
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready