0

I have WordPress installed on the root of my server, and I have a subfolder where Laravel is installed using the official Laravel installer. When I try to access using http://localhost/Laravel/ , I get a Http 500 Status Code

I tried the following:

sudo chown www-data:www-data  -R *
find . -type d -exec chmod 755 {} \;
find . -type f -exec chmod 644 {} \; 

I have also set Laravel/config/app.php to:

  • 'debug' => env('APP_DEBUG', true), and

  • 'url' => env('APP_URL', 'http://localhost/Laravel

but I still get 500.


I've also seen this question, but in my case it is the other way around. I have Wordpress and Laravel as a subfolder as opposed to the case in this question.

Community
  • 1
  • 1
senty
  • 12,385
  • 28
  • 130
  • 260

2 Answers2

0

Are you using Apache or Nginx ? If Apache, you need to config your vhost file to serve Laravel from a sub-folder. Particularly, you need to configure that when host.com/laravel URI is requested, it should be served using /home/host.com/laravel/public directory (basically different root/home location).
You also need to use mod_rewrite to rewrite your URL requests to the sub-folder be served from index.php from above location (and also prettify URLs).


The above should work just fine since its done same way in Nginx, for which I have included a full example of how its conf file should look

Here is how I setup-ed my location block which is working for me perfectly:

location ^~ /facebookschedule {  
alias /home/netcans/facebookschedule/public;  
try_files $uri $uri/ @foobar;  

location ~ \.php {  
fastcgi_pass unix:/var/run/php5-fpm.sock;  
fastcgi_split_path_info ^(.+\.php)(.*)$;  
include /etc/nginx/fastcgi_params;  
fastcgi_param SCRIPT_FILENAME /var/wwww/facebookschedule/public/index.php;  
}  
}  

location @foobar {  
rewrite /facebookschedule/(.*)$ /facebookschedule/index.php?/$1 last;  
}  

Source: http://shubhank.gaur.io/setup-laravel-5-in-subfolder-with-nginx/

vongolashu
  • 375
  • 3
  • 17
0

I had the same issue and running these two commands fixed it:

sudo chmod 755 -R Laravel
chmod -R o+w Laravel/storage

This is assuming Laravel is the project name, otherwise just change it to whatever you named the project.

Peter
  • 620
  • 4
  • 8