1

Recently I have reinstalled a server with Ubuntu 14.04 LTS, nginx/1.6.1 and php5-fpm. When I try to access index.html it's working when I try to access index.php i get "404 Not Found". I double checked the .conf files and I can't find what is the problem.

server {
    listen  m.y.i.p:80;
    server_name  www.example.com;
    rewrite ^(.*) http:// example.com$1 permanent;
}

server {
    listen  m.y.i.p:80;
    server_name example.com;

    root /var/www;
    index index.php index.html index.htm;

    location / {
        try_files $uri $uri/ /index.html;
    }

    access_log off;
    error_log /var/www/error.log;
    rewrite_log on;
    error_page 403 404 /404.html;

    error_page 500 502 503 504 /404.html;
    location = /404.html {
        root /var/www;
    }

    # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
    location ~ \.php$ {
        fastcgi_pass 127.0.0.1:9000;
        # With php5-fpm:
        #fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi_params;
    }
    location ~*  \.(jpg|jpeg|png|gif|ico|css|js)$ {
        expires 365d;
    }
}

Please help. Thank you!

masegaloeh
  • 17,978
  • 9
  • 56
  • 104
Bogdan Galan
  • 51
  • 1
  • 2
  • 7

1 Answers1

1

As it turned out to be "502 Bad Gateway" and not "404 Not Found", I`ve found the answer to my problem here https://stackoverflow.com/a/16497957/1845728.

Bogdan Galan
  • 51
  • 1
  • 2
  • 7