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 am trying to set up subdomain on my debian server with nginx.But I could not success.

I am using currently shared hosting with justhost.com, I wanna switch my site to linode server.

my /etc/nginx/conf.d/default.conf file is :

server {
    ## Your website name goes here.
    server_name example.com www.example.com;
    ## Your only path reference.
    root /var/www/example.com/;
    listen 80;
    ## This should be in your http block and if it is, it's not needed here.
    index index.html index.htm index.php;

    include conf.d/drop;

        location / {
                # This is cool because no php is touched for static content
            try_files $uri $uri/ /index.php?q=$uri&$args;
        }

        location ~ \.php$ {
            fastcgi_buffers 8 256k;
            fastcgi_buffer_size 128k;
            fastcgi_intercept_errors on;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_pass unix:/dev/shm/php-fpm-www.sock;


        }

}

server {
    ## Your website name goes here.
    server_name sub.example.com www.sub.example.com;
    ## Your only path reference.
    root /var/www/sub.example.com/;
    listen 80;
    ## This should be in your http block and if it is, it's not needed here.
    index index.html index.htm index.php;

    include conf.d/drop;

        location / {
                # This is cool because no php is touched for static content
            try_files $uri $uri/ /index.php?q=$uri&$args;
        }

        location ~ \.php$ {
            fastcgi_buffers 8 256k;
            fastcgi_buffer_size 128k;
            fastcgi_intercept_errors on;
            include fastcgi_params;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            fastcgi_pass unix:/dev/shm/php-fpm-www.sock;


        }
share|improve this question
    
What problem are you having? –  Michael Hampton Jan 13 '13 at 16:28
    
main site is working, but I can not access to sub site. –  ahmetlutfu Jan 13 '13 at 16:32
    
Again, what problem are you having with "access to sub site"? –  Michael Hampton Jan 13 '13 at 16:33
    
I can see on main site "Welcome to nginx!" but on the subdomain I am getting "This web page is not available". –  ahmetlutfu Jan 13 '13 at 16:37
    
Did you set up DNS records for it? –  Michael Hampton Jan 13 '13 at 16:37

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.