Problem with a virtualhost

Hello,

I am able to access domain.org.uk but www.domain.org.uk 404s and
defaults to the
nginx welcome page. It’s behaving as if it cannot find a
www.domain.org.uk match
so resorts to the default nginx page.

I can’t see anything wrong with my conf. Any ideas ?

Thank you

server {
listen 192.168.30.12;
server_name domain.org.uk www.domain.org.uk;
access_log /var/log/nginx/domain.org.uk.access.log main;

    location / {
            index   index.php index.html index.htm;
            root    /home/user/public_html;
    }

    location ^~ / {
            auth_basic            "Authorization Required";
            auth_basic_user_file 

/home/user/not_web_accessible/.htpasswd;
}

    location ~ \.php$ {
            fastcgi_pass 127.0.0.1:9000;
            fastcgi_index index.php;
            fastcgi_intercept_errors  on;
            fastcgi_param  SCRIPT_FILENAME

/home/user/public_html$fastcgi_script_name;
include /usr/local/nginx/fastcgi_params;
}

    # serve static files directly
    location ~* ^.+.(jpg|jpeg|gif|css|png|js|ico|html)$ {
        access_log        off;
        expires           2d;
    }

    # prevent access to .htaccess if still exist
    location ~ /\.ht {
            deny  all;
    }

}

BTW I can’t really use the wildcard *.domain.org.uk as I will probably
add
subdomains at some point.

I must’ve made a typo in my conf somewhere because when I copied a
working conf
over and re-editted it it worked fine.

I see you got the answer now. Was just going to say make sure your dns
is correct for the www.
Just in case you don’t know you can (or should) test your config with:
nginx -t
If the config has an error and you send a HUP then it will keep the old
one so your changes may not have been picked up. That can cause
confusion if you don’t use -t everytime.
Chris :slight_smile:

On Sat, Sep 6, 2008 at 7:32 AM, David [email protected] wrote:

   location ~ \.php$ {
           fastcgi_pass 127.0.0.1:9000;
   }

just for cleanup/simplicity…

you can put these into fastcgi_params:

fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_index index.php;
fastcgi_intercept_errors on;

and this can be included only once globally (or, you can just put the
contents directly into http {} just once and skip having a separate
file)

include /usr/local/nginx/fastcgi_params;

:slight_smile:

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs