Nginx shows 404 all the time

2014/03/18 03:00:43 [error] 834#0: *3 FastCGI sent in stderr: "PHP message: PHP Warning:  phpinfo():
It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function.
In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier.
We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/share/nginx/html/info.php on line 2"
while reading response header from upstream, client: 123.456.789.123, server: domain.com, request: "GET /info.php HTTP/1.1",
upstream: "fastcgi://unix:/var/run/php5-fpm.sock:", host: "domain.com"

Nginx shows 404 all the time. I got the above error from Nginx error log. Below is my Nginx config file.

server {
        listen 127.0.0.1:8080; ## listen to Varnish

        root /www/domain.com/htdocs;
        index index.php index.html index.htm;

        # Make site accessible from http://localhost/
        server_name domain.com;

        location / {
                # First attempt to serve request as file, then
                # as directory, then fall back to displaying a 404.
                try_files $uri $uri/ /index.php?q=$uri&$args;
                # Uncomment to enable naxsi on this location
                # include /etc/nginx/naxsi.rules
        }

        # Only for nginx-naxsi used with nginx-naxsi-ui : process denied reques$
        #location /RequestDenied {
        #       proxy_pass http://127.0.0.1:8080;
        #}

        error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
        #
        error_page 500 502 503 504 /50x.html;
        location = /50x.html {
                root /usr/share/nginx/html;
        }

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        location ~ \.php$ {
                try_files $uri =404;
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
        #       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini
        #
        #       # With php5-cgi alone:
        #       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_nam$
                include fastcgi_params;
        }

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        location ~ /\.ht {
                deny all;
        }
}

Any tips for resolving it?
Thanks!!

  • Vinod Dalvi
    • WP Unicorn

    Hi @Rufus,

    Sorry to hear the problem you are having.

    It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in /usr/share/nginx/html/info.php on line 2"

    Have you implemented the steps mentioned in the above error message to fix the error?

    Kind Regards,
    Vinod Dalvi

  • Tang Rufus
    • Design Lord, Child of Thor

    I have set the timezone in /etc/php5/fpm/php.ini

    If I change the root to /usr/share/nginx/html, I can find

    date
    date/time support	enabled
    "Olson" Timezone Database Version	0.system
    Timezone Database	internal
    Default timezone	Asia/Hong_Kong

    from domain.com/info.php

    However, 404 still if root changed to /www/domain.com/htdocs

  • Vinod Dalvi
    • WP Unicorn

    Hi @Rufus,

    Thank you for your reply.

    I don't have much experience in setting up Nginx so i will see if i can get any of my colleague here to answer you.

    I also recommend you to post your question in nginx community so that you will get answers there from nginx experts.

    Best Regards,
    Vinod Dalvi

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.