First time doing this. Two days since I struck this issue and have not located the problem.
I installed laravel
on a Ubuntu 18.04
instance on EC2
. The project works fine in my local Homestead
environment. After a battle with permissions I am now stuck with blank pages served by nginx/laravel
.
I am looking to set up permissions so that user ubuntu
can deploy updates from BitBucket
, while www-data
can run the Laravel
application.
I am stuck as I cannot seem to find where an error is logged / occurring.
A few points;
No errors in the site's
nginx
error logNginx
shows HTTP 200 response code in the site's access logI have
APP_DEBUG=true
in my.env
file for verbose stack traces, but nothing showsI have no errors showing in the
laravel.log
Browser will serve the site's logo if I point the URL to the logo file inside img folder
I set folder permissions based on this answer
/project =
Laravel's
root folder/project/public =
nginx
web root
My project folders permissions have been set like this:
sudo chown -R www-data:www-data /project
sudo usermod -a -G www-data ubuntu
sudo chown -R ubuntu:www-data /project
sudo find /project -type f -exec chmod 664 {} \;
sudo find /project -type d -exec chmod 775 {} \;
sudo chgrp -R www-data storage bootstrap/cache
sudo chmod -R ug+rwx storage bootstrap/cache
My nginx
config is:
server {
server_name project.com.au www.project.com.au;
root /home/ubuntu/project/public;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-XSS-Protection "1; mode=block";
add_header X-Content-Type-Options "nosniff";
index index.html index.htm index.php;
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
access_log /var/log/nginx/sc.access.log;
error_log /var/log/nginx/sc.error.log error;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php/php7.2-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.(?!well-known).* {
deny all;
}
listen 443 ssl; # managed by Certbot
ssl_certificate /etc/letsencrypt/live/project.com.au/fullchain.pem; # managed by Certbot
ssl_certificate_key /etc/letsencrypt/live/project.com.au/privkey.pem; # managed by Certbot
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot
}
server {
if ($host = www.project.com.au) {
return 301 https://$host$request_uri;
} # managed by Certbot
if ($host = project.com.au) {
return 301 https://$host$request_uri;
} # managed by Certbot
listen 80;
server_name project.com.au www.project.com.au;
return 404; # managed by Certbot
}
The second server
section was added by letsencrypt / Cert-Bot
.
A file list of my public
folder is:
-rw-r--r--+ 1 ubuntu www-data 281 Aug 16 16:02 browserconfig.xml
drwxr-xr-x+ 2 ubuntu www-data 4096 Aug 16 10:46 css
-rw-r--r--+ 1 ubuntu www-data 1150 Aug 16 16:02 favicon.ico
drwxr-xr-x+ 2 ubuntu www-data 4096 Aug 16 16:02 fonts
drwxr-xr-x+ 3 ubuntu www-data 4096 Aug 16 16:02 img
-rw-r--r-- 1 ubuntu www-data 1823 Aug 16 16:36 index.php
drwxr-xr-x+ 2 ubuntu www-data 4096 Aug 16 10:46 js
-rw-r--r--+ 1 ubuntu www-data 720 Aug 16 16:02 manifest.json
-rw-r--r-- 1 ubuntu www-data 192 Aug 16 16:02 mix-manifest.json
-rw-r--r-- 1 ubuntu www-data 24 Aug 16 15:28 robots.txt
-rw-r--r-- 1 ubuntu www-data 914 Aug 16 15:28 web.config
My nginx
access and error logs do not have any entries/
My project error log is empty. My project access log shows:
27.99.0.231 - - [19/Aug/2018:13:33:05 +0000] "GET / HTTP/1.1" 200 31 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36"
My home page is served blank, no nginx
errors, or laravel
stack traces. If I add /img/logo.png
to the base URL, then the logo is shown in the page.
Where else could I look? All research points to the conf file above bu I have not found anything out of the ordinary with mine.