aberkow
By:
aberkow

Grav CMS - page not found

February 14, 2017 438 views
CMS Nginx PHP Ubuntu 16.04

I'm brand new to digitalocean and server setup/configuration in general. Last night, I was trying to follow this tutorial to set up Grav inside a droplet. Things were going fine more or less until I tried to access the digitalocean.dev domain described in the tutorial. At that point the page failed to load (after spinning for a long time).

I am reasonably sure I set up my grav user and installation correctly, because I can switch between root and grav and because the bin/grav commands work. However I can't seem to find where the errors are. What would cause this kind of error? I'd be happy to share some code or error logs/messages if I knew what to look for. Thanks in advance for the help!

1 Answer

@aberkow

You can run tail -20 /var/log/nginx/error.log to pull the last 20 errors logged by NGINX. If you'll post that output to a code block, I'll be more than happy to take a look at it for you.

Also, can you check to see if you're able to access the site using just the Droplet IP?

  • Thank you very much @jtittle! Here's what I found in a file called error.log.1 (error.log doesn't seem to have anything in it.). NB - I fixed the error where I left the "s" off server on line 1. Same result.

    2017/02/13 02:30:43 [emerg] 25340#25340: unknown directive "erver" in /etc/nginx/sites-enabled/grav:1
    2017/02/13 13:21:42 [error] 25445#25445: *11 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 89.248.163.3, server: digitalocean.dev, request: "GET //phpmyadmin/scripts/setup.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "104.236.198.56"
    2017/02/13 13:21:42 [error] 25445#25445: *13 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 89.248.163.3, server: digitalocean.dev, request: "GET //pma/scripts/setup.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "104.236.198.56"
    2017/02/14 01:51:14 [error] 25445#25445: *25 FastCGI sent in stderr: "Primary script unknown" while reading response header from upstream, client: 91.196.50.33, server: digitalocean.dev, request: "GET http://testp3.pospr.waw.pl/testproxy.php HTTP/1.1", upstream: "fastcgi://unix:/run/php/php7.0-fpm.sock:", host: "testp3.pospr.waw.pl"
    

    Another log from access.log.1

    199.48.160.78 - - [13/Feb/2017:07:06:40 +0000] "GET / HTTP/1.0" 200 6092 "-" "-"
    139.162.119.197 - - [13/Feb/2017:08:17:24 +0000] "GET / HTTP/1.1" 200 6109 "-" "Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
    188.37.204.103 - - [13/Feb/2017:08:42:06 +0000] "GET / HTTP/1.0" 200 6092 "-" "Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)"
    144.217.128.238 - - [13/Feb/2017:09:39:57 +0000] "GET / HTTP/1.0" 200 6092 "-" "-"
    89.248.163.3 - - [13/Feb/2017:13:21:43 +0000] "GET //phpmyadmin/scripts/setup.php HTTP/1.1" 404 47 "-" "-"
    89.248.163.3 - - [13/Feb/2017:13:21:43 +0000] "GET //pma/scripts/setup.php HTTP/1.1" 404 47 "-" "-"
    89.248.163.3 - - [13/Feb/2017:13:21:43 +0000] "GET /muieblackcat HTTP/1.1" 404 1157 "-" "-"
    199.48.160.78 - - [13/Feb/2017:14:34:25 +0000] "GET / HTTP/1.0" 200 6092 "-" "-"
    146.0.229.51 - - [13/Feb/2017:15:32:42 +0000] "GET //recordings/LICENSE.txt HTTP/1.1" 403 152 "-" "Mozilla/5.0 zgrab/0.x"
    144.217.128.238 - - [13/Feb/2017:22:07:15 +0000] "GET / HTTP/1.0" 200 6092 "-" "-"
    144.217.128.238 - - [13/Feb/2017:22:32:09 +0000] "GET / HTTP/1.0" 200 6092 "-" "-"
    54.215.137.110 - - [14/Feb/2017:01:44:45 +0000] "GET / HTTP/1.1" 200 2239 "-" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36"
    91.196.50.33 - - [14/Feb/2017:01:51:14 +0000] "GET http://testp3.pospr.waw.pl/testproxy.php HTTP/1.1" 404 47 "-" "Mozilla/5.0 (Windows NT 5.1; rv:32.0) Gecko/20100101 Firefox/31.0"
    
    • @aberkow

      If you would, please post your NGINX server block configuration as well. Everything that's between server { and }.

      • @jtittle Thanks for being patient. I'm trying doing this between work and family. Here's the server block. I took it from Grav's tutorial.

        server {
            #listen 80;
            index index.html index.php;
        
            ## Begin - Server Info
            root /home/grav/www/html;
            server_name digitalocean.dev;
            ## End - Server Info
        
            ## Begin - Index
            # for subfolders, simply adjust the rewrite:
            # to use `/subfolder/index.php`
            location / {
                try_files $uri $uri/ /index.php?_url=$uri;
            }
            ## End - Index
        
            ## Begin - PHP
            location ~ \.php$ {
                # Choose either a socket or TCP/IP address
                fastcgi_pass unix:/run/php/php7.0-fpm.sock;
                # fastcgi_pass 127.0.0.1:9000;
        
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_index index.php;
                include fastcgi_params;
                fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
            }
            ## End - PHP
        
            ## Begin - Security
            # deny all direct access for these folders
            location ~* /(.git|cache|bin|logs|backups)/.*$ { return 403; }
            # deny running scripts inside core system folders
            location ~* /(system|vendor)/.*\.(txt|xml|md|html|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
            # deny running scripts inside user folder
            location ~* /user/.*\.(txt|md|yaml|php|pl|py|cgi|twig|sh|bat)$ { return 403; }
            # deny access to specific files in the root folder
            location ~ /(LICENSE|composer.lock|composer.json|nginx.conf|web.config|htaccess.txt|\.htaccess) { return 403; }
            ## End - Security
        }
        
Have another answer? Share your knowledge.