Skip to content
Grav 2.0 is officially stable. Read the announcement →
Archive

404 Error

Started by Muut Archive 11 years ago · 4 replies · 204 views
11 years ago

I have installed the skeleton for twenty in my root directory on amazon in an EC2 instance running nginx. When I go to the homepage it all loads correctly however, when I go to any of the other pages it does not load and comes up with a 404 Error. If there is any more information I need to provide could you please let me know.

11 years ago

Actually nginx can't pick up apache .htaccess files, you need to configure the nginx virtual host so it can route. The grav install provides a pretty detailed nginx.conf file, but a simple version is:

TXT
server {
        #listen 80 default_server;
        index index.html index.php;
        root /home/pi/www/blog;

        server_name localhost;

        location / {
                try_files $uri $uri/ /index.html;
                if (!-e $request_filename){ rewrite ^(.*)$ /index.php last; }
        }

        location ~ \.php$ {
                fastcgi_split_path_info ^(.+\.php)(/.+)$;
                fastcgi_pass unix:/var/run/php5-fpm.sock;
                fastcgi_index index.php;
                include fastcgi_params; 
                fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name;
        }
}
11 years ago

Thankyou for the help. Did not know you had to configure the nginx.conf.

11 years ago

Yes, it's the only reason I don't run nginx in development, as it's just really convenient to drop multiple grav sites into one directory and have the .htaccess files get picked up automatically for their routing. Would require manual setup of many virtualhost configurations for nginx.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1326 9 years ago
Archive · by Muut Archive, 9 years ago
2 921 9 years ago
Archive · by Muut Archive, 9 years ago
2 4050 9 years ago
Archive · by Muut Archive, 9 years ago
1 2928 9 years ago
Archive · by Muut Archive, 9 years ago
3 1107 9 years ago