On Sun, Jul 7, 2013 at 6:30 PM, lennart wrote:
>
> Is there a way to do this with regex or variables? I've ~15 domains and it
> would be more convenient to have only one entry "to rule them all" ;-)
>
the regex way, which is supposedly slower:
server {
server_name ~^www\.(?.+)$;
listen 80; l
Sorry but my last message was delayed, may be you didn't see it but the
problem is still not solved and it worked before with Apache. I would be
happy if you could help me, thanks!
Posted at Nginx Forum:
http://forum.nginx.org/read.php?2,240504,240630#msg-240630
_
I should correct my server_name line. It should not have the variable, but the
actual domain names. So I guess you'll still have to come back and add each
domain.
Sorry. On phone.
Sajan Parikh
On Jul 7, 2013, at 6:47 AM, Sajan Parikh wrote:
> Haven't testing this, but would you not be able
Jonathan Matthews Wrote:
---
> On 7 Jul 2013 10:30, "lennart" wrote:
> >
> > According to http://wiki.nginx.org/Pitfalls#Server_Name this is the
> best
> > solution to redirect www to no-www for one domain:
> >
> > server {
> > server_name www.
Haven't testing this, but would you not be able to replace 'domain.com'
with $host?
server {
server_name www.$host;
rewrite ^(.*) $scheme://$host$request_uri permanent;
}
That should work I think. Right now, I do it the way you've descrived
individually in all my .conf files for each dom
On 7 Jul 2013 10:30, "lennart" wrote:
>
> According to http://wiki.nginx.org/Pitfalls#Server_Name this is the best
> solution to redirect www to no-www for one domain:
>
> server {
> server_name www.domain.com;
> return 301 $scheme://domain.com$request_uri;
> }
> server {
> server_name domai
According to http://wiki.nginx.org/Pitfalls#Server_Name this is the best
solution to redirect www to no-www for one domain:
server {
server_name www.domain.com;
return 301 $scheme://domain.com$request_uri;
}
server {
server_name domain.com;
[...]
}
Is there a way to do this with regex or