Dear Experts,
I am trying to get a simple grav site working on a lightsail instance with Nginx but have been stuck at 404 error when navigating to the typography page which comes as part of the default installation of Grav.
When I access the site using the ip address, the navigation is working fine and I can access the site at https ://ip/myapp and https ://ip/myapp/typography is also working fine.
But when I access the site with the domain name (https ://www.myapp.com), the main page opens fine. But, when I navigate to https ://www.myapp.com/typography, I get an 404 error.
NGINX Error logs shows the following:
2019/03/29 12:39:53 [error] 3219#0: *55 open()
“/opt/bitnami/apps/myapp/htdocs/typography” failed (2: No such file or directory), client: xxx.xx.xxx.xxx, server: myapp.com, request: “GET /typography HTTP/1.1”, host: “www.myapp(dot)com”, referrer: “https: //www.myapp(dot)com/”
My configuration follows the bitnami documentation for nginx and the site is located in a subfolder under /opt/bitnami/apps/myapp/htdocs/
My configuration is as below:
The configuration files follow the same structure as per bitnami documentation.
vhosts file:
server {
listen 80;
root “/opt/bitnami/apps/myapp/htdocs”;
server_name myapp(dot)com www.myapp(dot)com;
include “/opt/bitnami/apps/myapp/conf/nginx-app.conf”;
}server {
listen 443 ssl;
root “/opt/bitnami/apps/myapp/htdocs”;
server_name myapp(dot)com www.myapp(dot)com;
ssl_certificate “/opt/bitnami/apps/myapp/conf/certs/server.crt”;
ssl_certificate_key “/opt/bitnami/apps/myapp/conf/certs/server.key”;
ssl_session_cache shared:SSL:1m;
ssl_session_timeout 5m;
ssl_ciphers HIGH:!aNULL:!MD5;
ssl_prefer_server_ciphers on;
include “/opt/bitnami/apps/myapp/conf/nginx-app.conf”;
}
nginx-prefix.conf file:
location /myapp {
alias “/opt/bitnami/apps/myapp/htdocs/”;
include “/opt/bitnami/apps/myapp/conf/nginx-app.conf”;
}
nginx-app.conf file:
Begin - Index
location /myapp {
try_files $uri $uri/ /myapp/index.php;
}End - Index
Begin - PHP
location ~ .php$ {
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_read_timeout 300;
fastcgi_pass unix:/opt/bitnami/php/var/run/www.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
include fastcgi_params;
}End - PHP
I am not sure which part of the configuration is causing ther error and your help would be much appreciated.
Thank you.