Hi, I'm having some troubles trying to catch all anything in the subdomain and redirect to mydomain.com:8080. It should be simple but I try somethings but I couldn't made it work. Thank you
on 10.03.2008 17:22
on 10.03.2008 17:41
Try this:
location / {
rewrite .* http://mydomain.com:8080$uri last;
}
on 10.03.2008 17:48
Thank You Denis, It's strange, If I enter directly on domain.com:8080 I receive an error (of the Firefox): "The page isn't redirecting properly Firefox has detected that the server is redirecting the request for this address in a way that will never complete." If I enter www.domain.com:8080 I am redirected to domain.com:8080 and I got that error. But if I go to anything.domain.com:8080 I receive the "Server not found" error. Denis S. Filimonov wrote: > Try this: > > location / { > rewrite .* http://mydomain.com:8080$uri last; > }
on 10.03.2008 18:06
On Mon, Mar 10, 2008 at 05:48:13PM +0100, Pedro Axl wrote: > But if I go to anything.domain.com:8080 I receive the "Server not found" > error. server { listen 8080; server_name domain.com; ... } server { listen 8080 default; server_name *.domain.com; rewrite ^ http://mydomain.com:8080$uri last; }
on 10.03.2008 18:10
On Monday 10 March 2008 12:48:13 Pedro Axl wrote: > Thank You Denis, > > It's strange, If I enter directly on domain.com:8080 I receive an error > (of the Firefox): "The page isn't redirecting properly > Firefox has detected that the server is redirecting the request for this > address in a way that will never complete." > Not sure what exactly it means. Could be a redirection loop. Try wget, its output is more verbose and sensible. > If I enter www.domain.com:8080 I am redirected to domain.com:8080 and I > got that error. > > But if I go to anything.domain.com:8080 I receive the "Server not found" > error. > Looks like there's no wildcard DNS record for *.domain.com
on 10.03.2008 18:17
I'm not pretty sure what I'm doing, hehe. I have to open a new server
{.....} right?
But If I do it when I try to start nginx I receive this error:
Starting nginx: 2008/03/10 14:22:33 [emerg] 17834#0: directive "server"
in /etc/nginx/nginx.conf:81 is not allowed here
Igor Sysoev wrote:
> On Mon, Mar 10, 2008 at 05:48:13PM +0100, Pedro Axl wrote:
>
>> But if I go to anything.domain.com:8080 I receive the "Server not found"
>> error.
>
> server {
> listen 8080;
> server_name domain.com;
> ...
> }
>
> server {
> listen 8080 default;
> server_name *.domain.com;
>
> rewrite ^ http://mydomain.com:8080$uri last;
> }
on 10.03.2008 18:33
On Mon, Mar 10, 2008 at 06:17:15PM +0100, Pedro Axl wrote: > I'm not pretty sure what I'm doing, hehe. I have to open a new server > {.....} right? > > But If I do it when I try to start nginx I receive this error: > Starting nginx: 2008/03/10 14:22:33 [emerg] 17834#0: directive "server" > in /etc/nginx/nginx.conf:81 is not allowed here You configuraiton file should have the following structure: http { server { location ... { } location ... { } location ... { } } server { } You did not close some bracket.
on 11.03.2008 13:19
Now I think the structure is ok, but I receive another error: Starting nginx: 2008/03/11 09:21:07 [emerg] 25934#0: first server name "*.domain.com" must not be wildcard in /etc/nginx/nginx.conf:145 Igor Sysoev wrote: > On Mon, Mar 10, 2008 at 06:17:15PM +0100, Pedro Axl wrote: > >> I'm not pretty sure what I'm doing, hehe. I have to open a new server >> {.....} right? >> >> But If I do it when I try to start nginx I receive this error: >> Starting nginx: 2008/03/10 14:22:33 [emerg] 17834#0: directive "server" >> in /etc/nginx/nginx.conf:81 is not allowed here > > You configuraiton file should have the following structure: > > http { > > server { > location ... { > } > > location ... { > } > > location ... { > } > } > > server { > > } > > You did not close some bracket.
on 11.03.2008 13:47
Pedro Axl wrote: >>> I'm not pretty sure what I'm doing, hehe. I have to open a new server >> location ... { >> >> } >> >> You did not close some bracket. > (.*\.)?\.domain\.com
on 11.03.2008 13:52
On Tue, Mar 11, 2008 at 01:19:49PM +0100, Pedro Axl wrote: > Now I think the structure is ok, but I receive another error: > > Starting nginx: 2008/03/11 09:21:07 [emerg] 25934#0: first server name > "*.domain.com" must not be wildcard in /etc/nginx/nginx.conf:145 The first name in server_name could be wildcard since 0.6.25 only. In early verisons use server_name www.domain.com *.domain.com;
on 11.03.2008 13:54
On Tue, Mar 11, 2008 at 08:37:24PM +0800, Cherife Li wrote: > >> > >> server { > >> server { > >> > >> } > >> > >>You did not close some bracket. > > > > (.*\.)?\.domain\.com No. First, in this version regex can not be first name too. Second, .domain.com is not valid name. Third, domain.com shoule be handled in another server.
on 11.03.2008 14:13
Igor Sysoev wrote: > On Tue, Mar 11, 2008 at 08:37:24PM +0800, Cherife Li wrote: > >> (.*\.)?\.domain\.com > > No. > First, in this version regex can not be first name too. > Second, .domain.com is not valid name. Oh, yeah, I meant (.*\.)?domain\.com. > Third, domain.com should be handled in another server. Got it. :-) Sorry, Pedro.
on 17.03.2008 19:39
Hi, Something strange is happening. I try all things you have suggested, and try exacly the example that's in nginx wiki (http://wiki.codemongers.com/NginxVirtualHostExample) and I simply can't make things work. Is there anything I have to do in the DNS records or something like? Cherife Li wrote: > Igor Sysoev wrote: >> On Tue, Mar 11, 2008 at 08:37:24PM +0800, Cherife Li wrote: >> >>> (.*\.)?\.domain\.com >> >> No. >> First, in this version regex can not be first name too. >> Second, .domain.com is not valid name. > Oh, yeah, I meant (.*\.)?domain\.com. >> Third, domain.com should be handled in another server. > Got it. :-) > > Sorry, Pedro.