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

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

But the problem is : When I use abc.com ( 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;
    server_name redmine.sieuthimoi.vn; 

    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  domain.com  _;
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 : domain.com works perfectly.

Anyone please help me. Thank you very much

  • 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

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

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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