0

I'm using a digital ocean Ubuntu LAMP on 14.04 , to configure let's encrypt certificate I followed this post :

https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-14-04

and as a Pre-requisites I configured one domain name following this post :

https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-14-04-lts

Now I installed laravel 5.2 on /var/www/myblog.com ,but now I can't see any thing on my site it shows 404 error which means that there is some thing wrong with the path or the Virtual Host doesn't show php files .

I'm not exactly sure what to do or where my files should be located within Virtual Host to be displayed properly

Praveen Kumar K S
  • 3,024
  • 1
  • 24
  • 31
SS2015
  • 5
  • 3
  • Laravel uses htaccess for routing. Do you have that enabled in your virtual host configuration? – user2027202827 Jun 18 '16 at 20:18
  • no i didn't enable any htaccess routing, i only specified the directory path. ServerAdmin ********@gmail.com DocumentRoot /var/www/myblog.com/public DirectoryIndex index.php ServerName myblog.com ServerAlias www.myblog.com – SS2015 Jun 19 '16 at 00:19
  • Yes, laravel uses the url rewriting of htaccess, so it needs to enabled on the server in order for you to reach your page. I mentioned how this is done in my answer to your question, but I may have not been entirely clear that this was related to htaccess. I'm updating my answer to clearify. – user2027202827 Jun 19 '16 at 00:21
  • still nothing is showing up even after restarting the server and forced the browser to display index.php could it be couse of the path /var/www/myblog.com/public not exactly sure – SS2015 Jun 19 '16 at 00:35
  • I added a link in an edit to my answer. Have you updated the permissions on the `storage` directory yet? – user2027202827 Jun 19 '16 at 00:41
  • i keep getting this error (chmod: cannot access ‘storage’: No such file or directory) – SS2015 Jun 19 '16 at 01:03
  • you need to be in the same directory as the storage directory when you run that command. – user2027202827 Jun 19 '16 at 01:04
  • after restarting i got this error (AH00112: Warning: DocumentRoot [/var/www/myblog.com/public_html] does not exist) when i followed the post i created this folder path then i deleted and installed laravel within /var/www/myblog.com and i updated the DocumentRoot but somehow it seams to be the problem – SS2015 Jun 19 '16 at 01:08
  • What is the current full path to your public_html folder within your laravel installation? That is what you should set DocumentRoot to. – user2027202827 Jun 19 '16 at 01:17
  • there is no public_html folder i deleted and installed a new laravel app and by default laravel has public folder and i modified the path to /var/www/myblog.com/public ,should i have not deleted it ? or should i rename public to public_html?? – SS2015 Jun 19 '16 at 03:28
  • Do not rename the public folder. That will cause issues within laravel. If `/var/www/myblog.com` is the location of your laravel installation, then `DocumentRoot` should point to `/var/www/myblog.com/public`, and it sounds like it does. I think in order to fix this I will need some more information. Maybe we could pick a time to meet in chat? – user2027202827 Jun 19 '16 at 15:20

1 Answers1

0

Laravel using the url rewriting features of .htaccess. This is quite often not the default configuration in a server installation, so you need to enable it manually, either globally, or for the particular virtual host you need it for. I would recommend you enable it only for the sites you need it on. In your virtual host configuration, make sure you include AllowOverride All for the directory that laravel is installed under. It will be something along the lines of this within the particular virtual host.

<Directory /var/www/myblog.com>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
</Directory>

Let me know if this fixes your problem.

EDIT:

The other thing that you may not have done yet is set up the correct permissions on the storage directory as described in the answer here.

Community
  • 1
  • 1
user2027202827
  • 1,234
  • 11
  • 29