So I am trying to build a custom vagnt box with Laravel 5.2 on CentOS 7.2. I successfully created a vagrant box running centos and installed LAMP stack and composer on it. Also, I am using laravel installer to create Laravel 5.2 projects with composer as described [here][1]. Now from here I have tried two different methods:
Create new laravel project as
sudo
on/var/www/html
I ran
sudo laravel new <project name>
and it created/var/www/html/<project name>
. Added this tohttpd.conf
:Alias /MyLaravel /var/www/html/<project name>/public <VirtualHost *:80> DocumentRoot /var/www/html<project name>/public <Directory /var/www/html/<project name>> AllowOverride All </Directory> </VirtualHost>
With following permissions set:chmod 775 /var/www/html/<project name>/storage
sudo chown -R apache:apache /var/www/html/<project name>
sudo chmod 755 /var/www
Everything works fine. No issues.
Create new laravel project in home directory and use symbolic link to
/var/www/html
I have run:
laravel new <project name>
in home directory and it created/home/vagrant/<project name>
then I have created a symbolic link using:ln -s /home/vagrant/<project name> /var/www/html
. Now I have same permissions and configurations on httpd.conf.This time I get the error: Forbidden You don't have permission to access / on this server.
I assume there is some configuration that I am missing. I have tried changing both original and symbolic link permissions and adding symlink options in httpd.conf with no success. Please kindly help.
Respose 1: Output of ls -al /var/www/html/<project name>
drwxrwxr-x. 11 apache apache 4096 Jul 19 21:25 .
drwx------. 7 vagrant vagrant 4096 Jul 19 21:24 ..
drwxrwxr-x. 10 apache apache 4096 Jul 19 21:24 app
-rw-rw-r--. 1 apache apache 1646 Jul 19 21:24 artisan
drwxrwxr-x. 3 apache apache 51 Jul 19 21:24 bootstrap
-rw-rw-r--. 1 apache apache 1272 Jul 19 21:24 composer.json
-rw-rw-r--. 1 apache apache 113359 Jul 19 21:24 composer.lock
drwxrwxr-x. 2 apache apache 4096 Jul 19 21:24 config
drwxrwxr-x. 5 apache apache 68 Jul 19 21:24 database
-rw-rw-r--. 1 apache apache 478 Jul 19 21:25 .env
-rw-rw-r--. 1 apache apache 443 Jul 19 21:24 .env.example
-rw-rw-r--. 1 apache apache 61 Jul 19 21:24 .gitattributes
-rw-rw-r--. 1 apache apache 73 Jul 19 21:24 .gitignore
-rw-rw-r--. 1 apache apache 503 Jul 19 21:24 gulpfile.js
-rw-rw-r--. 1 apache apache 212 Jul 19 21:24 package.json
-rw-rw-r--. 1 apache apache 1026 Jul 19 21:24 phpunit.xml
drwxrwxr-x. 2 apache apache 90 Jul 19 21:24 public
-rw-rw-r--. 1 apache apache 1918 Jul 19 21:24 readme.md
drwxrwxr-x. 5 apache apache 42 Jul 19 21:24 resources
-rw-rw-r--. 1 apache apache 567 Jul 19 21:24 server.php
drwxrwxr-x. 5 apache apache 43 Jul 19 21:24 storage
drwxrwxr-x. 2 apache apache 47 Jul 19 21:24 tests
drwxrwxr-x. 29 apache apache 4096 Jul 19 21:25 vendor
P.S. Here are links I have already explored: