Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I install nginx 1.0.0 and i installed it /usr/local/nginx1.0.0/. and I try to modify /usr/local/nginx1.0.0/cont/nginx.conf file.

I just copy default file. and replace server_name and root path

and I connected -> it works (there is nginx working message.)

but I connected -> it is not working.(there is 404 Not Found message.)

and url is =

and I try to server_name => * (but same problum)

this is my nginx.conf code. am i wrong config? or wrong install?

server {
        listen       80;

        location / {
            root   html;
            index  index.html index.htm;

        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;

      location ~ \.php$ {
            root           html;
            fastcgi_index  index.php;
            fastcgi_param  SCRIPT_FILENAME  html$fastcgi_script_name;
            include        fastcgi_params;

        location ~ /\.ht {
            deny  all;
share|improve this question

Do you have any other server {} blocks that might have a better match for and override this block?

Also, you probably don't want to use fastcgi_index. It's only useful in a few unusual circumstances. For the typical case like you have, you want to use something like

try_files $uri $uri/index.html $uri/index.htm $uri/index.php

in your location / {} block. The last item generates an internal redirect to the location ~ \.php$ {} block.

share|improve this answer
Just FYI, $uri/ in try_files will apply your index directive as well, so you don't need to specify all the index files. Plus, your last argument to try_files must be a guaranteed file or a named location. – Martin Fjordvald Apr 17 '11 at 23:00
thnak you friends!!! I solved it after your advice! – artworker Apr 18 '11 at 0:42
I make 2 servers 1. 2. * and i redirect * -> and i add try_files it works greatfully! – artworker Apr 18 '11 at 0:47

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.