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

Nginx 404

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

I have nginx setup in front of my grav installation. Also installed php-fpm. php-fpm is running, nginx is running with the provided config file in the base repo and I'm getting a 403 Forbidden when I navigate to my root page and then a 404 saying Woops. Looks like this page doesn't exist. when I navigate to /index.php. Any ideas on whats happening? Here's my nginx file

TXT

server {
    listen 80;
    index index.html index.php;
    server_name localhost;
    root /opt/grav;

    # for subfolders, simply adjust the rewrite:
    # to use `/subfolder/index.php`
    location / {
        try_files $uri $uri/ /index.html;
        if (!-e $request_filename){ rewrite ^(.*)$ /index.php last; }
    }

    location ~ \.php$ {
        # Choose either a socket or TCP/IP address
        fastcgi_pass unix:/var/run/php5-fpm/grav.sock;
        # fastcgi_pass 127.0.0.1:9000;
11 years ago

Sorry for the multiple posts I made, tried to fix formatting and there's no edit button. Just an undo. But it should be good now.

11 years ago

It's definitely related to your rewrite setup and the nginx configuration.

Are you accessing your site via http://localhost ?

11 years ago

Hey @rhukster, thanks for checking in. Turns out with enough time and hours on google I figured it out. I am somewhat new to php, so coming from a sysadmin background I was banging my head against a wall. But the fix was chmod +x /opt and chmod +x /opt/grav. It may have also been a chmod 755 /opt/grav as well but I am not sure if I had already set that or not. I thought I did.

Suggested topics

Topic Participants Replies Views Activity
Archive · by Deleted User, 9 years ago
0 1349 9 years ago
Archive · by Muut Archive, 9 years ago
2 934 9 years ago
Archive · by Muut Archive, 9 years ago
2 4060 9 years ago
Archive · by Muut Archive, 9 years ago
1 2946 9 years ago
Archive · by Muut Archive, 9 years ago
3 1118 9 years ago