Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
PostPosted: Tue Nov 01, 2011 11:03 am 
Offline
Senior Newbie

Joined: Tue Nov 01, 2011 10:15 am
Posts: 11
Hi guys,
I'm having a problem with the rewrite URL for nginx. It does rewrite the URL but it also changes the location of the root to the default and "Welcome to nginx!" is displayed (instead of the php/html). Here's the code I have in the conf in the sites-enabled folder:

Code:
server{
        listen 80;
        server_name isfollowing.co.uk;
        rewrite ^/(.*) http://www.isfollowing.co.uk/$1 permanent;
        access_log /var/log/isfollowing.access_log;
        error_log /var/log/isfollowing.error_log;

        location / {
          root /srv/www/isfollowing.co.uk;
          index index.php index.html index.htm;
...
...
}


Test it out at http://isfollowing.co.uk

Anyone know how I can solve this problem? Thanks!


Top
   
 Post subject:
PostPosted: Tue Nov 01, 2011 11:10 am 
Offline
Senior Newbie

Joined: Tue Nov 01, 2011 10:15 am
Posts: 11
I solved it by adding this code to the nginx.conf:

Code:
server {
    listen 80 default;
    server_name _;
    rewrite ^ http://www.$host;
}


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 2 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group