CentOS 7 + Laravel中的虚拟主机 [英] Virtual Hosts in CentOS 7 + Laravel

查看:109
本文介绍了CentOS 7 + Laravel中的虚拟主机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的VirtualHosts出现问题

I have problems with my VirtualHosts

网站目录为/var/www/html/laravel httpd.conf文件是

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

推荐答案

我找到了解决方案!

我在/var/www/html文件夹中有很多站点. www.example.com/site1 www.example.com/site2 ...

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

解决方案是在 httpd.conf 中为每个站点创建一个别名. 例如:

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>

这篇关于CentOS 7 + Laravel中的虚拟主机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆