I just installed the latest Grav on nginx on Ubuntu 20.04 based on a tutorial at How to Setup Grav CMS with Nginx on Ubuntu Linux - Geek Rewind
The tutorial installs several php 7.2 packages, but I changed them to 7.4. Also, I used a different address to get the grav package. I used https://getgrav.org/download/core/grav-admin/latest .
When I went to my url (rpallen.com.br) I got a “bad gateway” error. After some research I discovered that the config file in the sites-available directory referred to php 7-2. After changing this to 7.4, the “bad gateway” error went away. In the URL address bar of the browser, I enter just rpallen.com.br. The browser then goes to rpallen.com.br/admin and displays a page: 404 Not Found (nginx/1.18.0 (Ubuntu)).
Below is:
the code in the config file (/etc/nginx/sites-available/grav )
a listing of the webroot contents of /var/www/html/grav
a list of changes I made to the php.ini file
CONFIG FILE:
server {
listen 80;
listen [::]:80;
root /var/www/html/grav;
index index.php index.html index.htm;
server_name rpallen.com.br www.rpallen.com.br;client_max_body_size 1024M; location / { try_files $uri $uri/ /grav/index.php?_url=$uri&$query_string; } location ~ \.php$ { include snippets/fastcgi-php.conf; fastcgi_pass unix:/var/run/php/php7.4-fpm.sock; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } listen [::]:443 ssl ipv6only=on; # managed by Certbot listen 443 ssl; # managed by Certbot ssl_certificate /etc/letsencrypt/live/rpallen.com.br/fullchain.pem; # manag> ssl_certificate_key /etc/letsencrypt/live/rpallen.com.br/privkey.pem; # man> include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
WEBROOT CONTENTS:
root@encontro:/var/www/html/grav# ls -l
total 460
drwxr-xr-x 2 www-data www-data 4096 Dec 4 14:02 assets
drwxr-xr-x 2 www-data www-data 4096 Dec 4 14:02 backup
drwxr-xr-x 2 www-data www-data 4096 Dec 4 14:02 bin
drwxr-xr-x 4 www-data www-data 4096 Dec 10 11:41 cache
-rwxr-xr-x 1 www-data www-data 145285 Dec 4 14:02 CHANGELOG.md
-rwxr-xr-x 1 www-data www-data 3216 Dec 4 14:02 CODE_OF_CONDUCT.md
-rwxr-xr-x 1 www-data www-data 3752 Dec 4 14:02 composer.json
-rwxr-xr-x 1 www-data www-data 231900 Dec 4 14:02 composer.lock
-rwxr-xr-x 1 www-data www-data 7098 Dec 4 14:02 CONTRIBUTING.md
drwxr-xr-x 2 www-data www-data 4096 Dec 4 14:02 images
-rwxr-xr-x 1 www-data www-data 1710 Dec 4 14:02 index.php
-rwxr-xr-x 1 www-data www-data 1071 Dec 4 14:02 LICENSE.txt
drwxr-xr-x 2 www-data www-data 4096 Dec 4 14:02 logs
-rwxr-xr-x 1 www-data www-data 76 Dec 4 14:02 now.json
-rwxr-xr-x 1 www-data www-data 6701 Dec 4 14:02 README.md
-rwxr-xr-x 1 www-data www-data 227 Dec 4 14:02 robots.txt
-rwxr-xr-x 1 www-data www-data 460 Dec 4 14:02 SECURITY.md
drwxr-xr-x 10 www-data www-data 4096 Dec 4 14:02 system
drwxr-xr-x 2 www-data www-data 4096 Dec 4 14:02 tmp
drwxr-xr-x 8 www-data www-data 4096 Dec 4 14:02 user
drwxr-xr-x 28 www-data www-data 4096 Dec 4 14:02 vendor
drwxr-xr-x 2 www-data www-data 4096 Dec 4 14:02 webserver-configs
CHANGES TO php.ini FILE:
sudo nano /etc/php/7.4/fpm/php.ini
file_uploads = On
allow_url_fopen = On
memory_limit = 512M
upload_max_filesize = 1024M
max_execution_time = 360
cgi.fix_pathinfo = 0
date.timezone = America/Bahia