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.

I want to open a website with no domain name from IP/folder_name Each time I try to access the website , I get redirected to an other website on the same server : Here is my default configuration :

server {
   listen 80 default;
   server_name localhost;
   root /usr/share/nginx/www/;
   location /justice.ma {
   root  /usr/share/nginx/www/justice.ma/;
}
 location / {
        index  index.html index.htm index.php;
    }
    location ~ \.php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_pass php5-fpm-sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_intercept_errors on;
    }
}

the other website configuration (It force the redirection to this website) :

        server {
            listen 80;
            server_name domain.com www.domain.com;
            root /usr/share/nginx/www/domain.com;
            return 301 https://domain.com;

}
# HTTPS server
#
server {
    listen 443;
    server_name  domain.com;

    root /usr/share/nginx/www/domain.com;
    index index.php;

    ssl on;
    ssl_certificate /usr/share/nginx/www/domain.com/domain.com.crt;
    ssl_client_certificate /etc/nginx/www/domain.com.ca;
    ssl_certificate_key /etc/ssl/private/domain.com.key;

    ssl_session_timeout 5m;

    ssl_protocols SSLv3 TLSv1;
    ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP;
    ssl_prefer_server_ciphers on;

location /phpmyadmin {
  alias /usr/share/phpmyadmin/;
  try_files $uri $uri/ /index.php;
}
location ~ ^/phpmyadmin(.+\.php)$ {
  alias /usr/share/phpmyadmin$1;
  fastcgi_pass php5-fpm-sock;
  fastcgi_index index.php;
  fastcgi_param SCRIPT_FILENAME /usr/share/phpmyadmin$1;
  include fastcgi_params;
}
    location / {
        try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
    try_files $uri =404;
    include fastcgi_params;
    fastcgi_pass php5-fpm-sock;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    fastcgi_intercept_errors on;
    }
    location /uploads/ { 
    location ~ .*\.(php).*$ 
    { 
    deny all; 
    } 
        }
}

Please Help!

share|improve this question

1 Answer 1

up vote 0 down vote accepted
  1. Clear your browser cache.
  2. Make sure that redirect comes from nginx, not your php script.
share|improve this answer
    
It was like , have you tried turning it off ? :D Thanks a lot man , it worked ! –  Aymane Shuichi Nov 14 '13 at 12:03

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.