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

I have a subdomain with a magento store on it, well at least that what I want.

It seems that nginx isn't detecting it for some reason and is just serving the default root back.

So when I type in songportal.ottawakaraoke.com it serves back whats at ottawakaraoke.com - but silly.ottawakaroke.com throws a 404.

Here is my config:

server {
    listen 80;
    server_name songportal.ottawakaraoke.com;
    access_log /var/www/songportal.ottawakaraoke.com/logs/access.log;
    error_log /var/www/songportal.ottawakaraoke.com/logs/error.log;
    root /var/www/songportal.ottawakaraoke.com/public_html/;

    location / {
        index index.php;
    }


    ## Main Magento location
    location @handler {
       rewrite / /index.php;
     }

    location ~ .php/ { ## Forward paths like /js/index.php/x.js to relevant handler
        rewrite ^(.*.php)/ $1 last;
        }


    ####################################################################################

    ## Execute PHP scripts
    location ~ .php$ {
        fastcgi_pass   127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $request_filename;
        #fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
        fastcgi_send_timeout 1800;
        fastcgi_read_timeout 1800;
        fastcgi_connect_timeout 1800;
        ## Store code with multi domain
        #fastcgi_param  MAGE_RUN_CODE $storecode;
        ## Default Store code
        fastcgi_param  MAGE_RUN_CODE default; 
        fastcgi_param  MAGE_RUN_TYPE store; ## or website;
        include        fastcgi_params; ## See /etc/nginx/fastcgi_params
        }



#    location ~ \.php$ {
#        include /etc/nginx/fastcgi_params;
#        fastcgi_pass  127.0.0.1:9000;
#        fastcgi_index index.php;
#        fastcgi_param SCRIPT_FILENAME $request_filename;
#    }
}

In my main nginx config I have this line, pulling in all the appropriate sites_enabled/available configs

    # The default server is in conf.d/default.conf
include /etc/nginx/conf.d/*.conf;

## Load virtual host conf files. ##
include /etc/nginx/sites-enabled/*;

Any ideas would be fantastic, i have been mucking around with this for a while.

share|improve this question
    
How have you configured silly.ottawakaraoke.com in sites-available directory? Have you made a symlink from sites-available to sites-enabled? –  Tero Kilkanen Jul 14 at 10:39
    
silly isn't the problem. Its songportal.ottawakaraoke.com which is serving up the root of ottawakaraoke.com which is the issue. –  FaddishWorm Jul 14 at 10:45
    
So, have you made the symlink? And have you reloaded nginx after configuration change? Also, you should replace .php with \.php in your configuration, because in regex . matches any character, and you have to escape it to match a dot. –  Tero Kilkanen Jul 14 at 10:53
    
Yea I have them simlinked, I am editing via webmin (was using terminal). The simlink should be there automatically. Is there anything else I am missing? Clearly the subdomains aren't configured properly so its serving the default stuff right? –  FaddishWorm Jul 14 at 11:30
    
Did you restart nginx? –  Michael Hampton Jul 14 at 11:38

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.