+1

[Tutorial] Installing grav on Ajenti V

zoid 8 years ago updated 8 years ago 0

I had a lot of trouble getting grav to work due to the nginx environment and conf generation. This is a problem because I use grav for lots of my freelance projects and would like it to work with ajenti.


Make your website, put the grav files in the site directory. Disable maintinence mode. And put this in advanced -> custom configuration. Make sure you change the /srv/ directory to your site name

    location / {
             root   /srv/sitename; 
                 index  index.php;
        if (!-e $request_filename){ rewrite ^(.*)$ /index.php last; }
    }
    location /images/ {
        # Serve images as static
    }
    location /user {
            rewrite ^/user/accounts/(.*)$ /error redirect;
            rewrite ^/user/config/(.*)$ /error redirect;
            rewrite ^/user/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ /error redirect;
        }
        location /cache {
        rewrite ^/cache/(.*) /error redirect;
        }
        location /bin {
            rewrite ^/bin/(.*)$ /error redirect;
        }
        location /backup {
        rewrite ^/backup/(.*) /error redirect;
        }
        location /system {
            rewrite ^/system/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ /error redirect;
        }
        location /vendor {
            rewrite ^/vendor/(.*)\.(txt|md|html|php|yaml|json|twig|sh|bat)$ /error redirect;
        }

Then go to content, add a php fastcgi with default parameters, and go to advanced, and add

            fastcgi_split_path_info ^(.+\.php)(/.+)$;
            fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

Then it will serve pages with url redirection working properly. Enjoy!