Virtual Hosts in CentOS 7 + Laravel
Asked Answered
O

1

0

I have problems with my VirtualHosts

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

enter image description here

When open the website show me this error: enter image description here

Somebody can help me? Thanks

Okubo answered 2/6, 2016 at 14:13 Comment(4)
Your servername should not include the /laravel part. That's the only problem.Lovelady
Also change dark blue to cyan or something!Lovelady
@Lovelady but i have 2 websites in /var/www/html. I removed the /laravel for a test, but not working too.Okubo
Sure, they need to have different hostnames then.Lovelady
O
2

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>
Okubo answered 2/6, 2016 at 17:3 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.