HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials

HowtoForge Forums | HowtoForge - Linux Howtos and Tutorials (http://www.howtoforge.com/forums/index.php)
-   Installation/Configuration (http://www.howtoforge.com/forums/forumdisplay.php?f=27)
-   -   Apache2 to Apache2 + Nginx (http://www.howtoforge.com/forums/showthread.php?t=57257)

sumfvm 11th May 2012 13:27

Apache2 to Apache2 + Nginx
 
Hi all,

I follow this guide: http://www.howtoforge.com/nginx-catc...n-debian-lenny

All is working perfectly for all customers who own a subdomain like user.my-domain.com but for those owning their own domain name, they are redirected to their-domain.com and www.their-domain.com don't work anymore, not fully, the files like .css and .js aren't found (nginx's logs showing that nginx try to find /var/www/www.domain.com instead of /var/www/domain.com).

I think it is because this Nginx directive:
Code:

#### www. redirect        - all domains starting with www will be redirected to http://domain. ####
    if ($host ~* ^(www\.)(.+)) {
        set $rawdomain $2;
        rewrite ^/(.*)$  http://$rawdomain/$1 permanent;
    }

In fact, I don't understand the presence of it...

Any idea?

Regards,

falko 12th May 2012 11:20

Please hardcode the document root - instead of
Code:

root  /var/www/$host/web;
use
Code:

root  /var/www/domain.com/web;

sumfvm 12th May 2012 13:15

Quote:

Originally Posted by falko (Post 278977)
Please hardcode the document root - instead of
Code:

root  /var/www/$host/web;
use
Code:

root  /var/www/domain.com/web;

Thanks for the trick Falko but the problem will stay for all the subdomains, istn't it?

falko 13th May 2012 10:31

That's possible. I didn't try the tutorial, but looking at it, I'd say

Code:

root  /var/www/$rawdomain/web;
is the correct solution.


All times are GMT +2. The time now is 13:24.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2014, vBulletin Solutions, Inc.