Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

Short background - there is a site (powered by Frog CMS) hosted on VPS with Apache installed. To cut costs a bit, I've moved to another VPS hosting with cheaper plan.

I've installed nginx, php-cgi and before moving production version, made a test version - "http://test-mysite.lv". It seemed to work fine except the admin part. When I enter this url "http://test-mysite.com/admin/" , browser is redirected to production site backend - "http://www.mysite.lv/admin/?/login". I don't have any idea , why I get redirected.

I configured this virtual host like this :

server {
  listen       80;
  server_name  www.test-mysite.lv test-mysite.lv;

  location / {
               root        /var/www/vhosts/test-mysite.lv;
               index           index.php index.html;
            }

  error_page  404              /index.html;

  # redirect server error pages to the static page /50x.html
  error_page   500 502 503 504  /50x.html;
  location = /50x.html {
      root   share/nginx/html;
  }

  location ~.*\.php$ {
      #root           html;
      fastcgi_pass   127.0.0.1:9000;
      fastcgi_index  index.php;
      fastcgi_param  SCRIPT_FILENAME  /var/www/vhosts/test-mysite.lv$fastcgi_script_name;
      #fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
      include        fastcgi_params;
  }

  location ~ /\.ht {
     deny  all;
  }
}

Site root permissions :

ls -la /var/www/vhosts/test-mysite.lv/
total 228
drwxr-xr-x 7 www-data www-data   4096 Aug 21 17:58 .
drwxr-xr-x 4 www-data www-data   4096 Aug 21 17:58 ..
drwxr-xr-x 8 www-data www-data   4096 Aug 21 17:58 .git
-rw-r--r-- 1 www-data www-data     25 Aug 21 17:58 .gitignore
-rw-r--r-- 1 www-data www-data   1387 Aug 21 17:58 404.php
-rw-r--r-- 1 www-data www-data    689 Aug 21 17:58 _.htaccess
drwxr-xr-x 6 www-data www-data   4096 Aug 21 17:58 admin
-rw-r--r-- 1 www-data www-data  13667 Aug 21 17:58 changelog.txt
-r--r--r-- 1 www-data www-data   1478 Aug 21 17:58 config.php
-rw-r--r-- 1 www-data www-data 112640 Aug 21 17:58 db.sqlite
-rw-r--r-- 1 www-data www-data   2379 Aug 21 17:58 exception.txt
-rw-r--r-- 1 www-data www-data   1406 Aug 21 17:58 favicon.ico
drwxr-xr-x 6 www-data www-data   4096 Aug 21 17:58 frog
-rw-r--r-- 1 www-data www-data   2980 Aug 21 17:58 index.php
-rw-r--r-- 1 www-data www-data  35146 Aug 21 17:58 license.txt
drwxr-xr-x 5 www-data www-data   4096 Aug 21 17:58 public
-rw-r--r-- 1 www-data www-data   1083 Aug 21 17:58 readme.txt
drwxr-xr-x 3 www-data www-data   4096 Aug 21 17:58 tutorials

Any help would be appreciated.

share|improve this question
    
Does admin/index.php exist and include some codes? –  quanta Aug 22 '11 at 14:52
    
ROFLMAO. There was such file actually and everything's fine with that file. But you pointed me the right direction. Main URL in this CMS is configured in config.php. After changing it from mysite.lv to test-mysite.lv it worked fine. –  Edgars Jekabsons Aug 22 '11 at 15:09

1 Answer 1

The problem wasn't in nginx config, it was my CMS configuration.

In config.php, I changed define('URL_PUBLIC', 'http://mysite.lv'); to define('URL_PUBLIC', 'http://test-mysite.lv'); and it worked.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.