Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

I have a server Ubuntu 11.10 with nginx 1.2.1 Asumme that my domain is : Nginx served as a reverse proxy : => point to webrick redmine on port 3000 => point to apache2 port 8080,, and all domain (etc :, , ) => php-fastcgi port 9000

You may wonder why I have to accept all domain (, , ) , yes, this is our service that allow customers to use their domain in our Multi-Tanency App.

But the problem is : When I use ( add a record on file hosts on my laptop) , to access my server , nginx redirect the request to our redmine . I want nginx to redirect to php-fastcgi like configuration.

here is my configuration on Nginx : (/etc/nginx/sites-enabled/)


server {
    listen   80;

    access_log  /var/log/nginx/access.log;

    location / {
    auth_basic  "Not Allow Here";
    auth_basic_user_file /etc/nginx/htpasswd;
            include         /etc/nginx/proxy.conf;


And PHP-FastCgi

server {
#listen   80; ## listen for ipv4; this line is default and implied
#listen   [::]:80 default_server ipv6only=on; ## listen for ipv6

root /usr/share/nginx/www/site;
index index.php index.htm index.html;

# Make site accessible from http://localhost/
server_name  _;
location ~ .php$ {
    try_files       $uri /index.php
    index index.php;
        fastcgi_index   index.php;
        fastcgi_param   SCRIPT_FILENAME /usr/share/nginx/www/site$fastcgi_script_name;
        include         fastcgi_params;


Note that : works perfectly.

Anyone please help me. Thank you very much

share|improve this question
What are the file names of these configs? I'm wondering if nginx is like Apache, and the first server/vhost it encounters becomes the default. – becomingwisest Jul 11 '12 at 16:07
the redmine config is : redmine.conf I use the default file for configuring PHP ( multidomain) Does it matter ? – Summer Nguyen Jul 11 '12 at 16:09
"default file" means /etc/nginx.conf? or something else? – becomingwisest Jul 11 '12 at 16:15
/etc/nginx/sites-enabled/default . I use this file . Is it OK ? – Summer Nguyen Jul 11 '12 at 16:25

1 Answer 1

up vote 1 down vote accepted

You should use listen 80 default_server; in your PHP-FastCGI server section.

share|improve this answer
Thank you, that works – Summer Nguyen Jul 11 '12 at 16:35

Your Answer


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.