-->

Virtual Hosts in CentOS 7 + Laravel

2019-09-16 06:49发布

问题:

I have problems with my VirtualHosts

The Directory of the website is /var/www/html/laravel The httpd.conf file is

When open the website show me this error:

Somebody can help me? Thanks

回答1:

I found a Solution!

I have many sites in /var/www/html folder. www.example.com/site1 www.example.com/site2 ...

The solution is create one alias for each site in httpd.conf. example:

Alias /site1 /var/www/html/site1
<VirtualHost *:80>
    DocumentRoot "/var/www/html/site1"
</VirtualHost>

Alias /laravel /var/www/html/laravel/public
<VirtualHost *:80>
       DocumentRoot /var/www/html/laravel/public

       <Directory /var/www/html/laravel>
              AllowOverride All
       </Directory>
</VirtualHost>