我(在Macbook pro Yosemite 10.10.5上运行)有一个主机文件,其中包含以下内容:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot “/Users/samir/Sites/theblog/”
ServerName theblog.dev
ServerAlias www.theblog.dev
ErrorLog "/usr/local/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/usr/local/var/log/apache2/dummy-host2.example.com-access_log" common
</VirtualHost>
对于/ Users / samir / Sites / theblog /中的文件夹,我希望能够从http://theblog.dev访问它,但是现在访问/ theblog的唯一方法是复制和将它粘贴在/ Library / WebServer / Documents中,如何将位置更改为Users / samir / Sites?我如何让网址发挥作用?
顺便说一句,我正在使用laravel 5.
提前谢谢!
答案 0 :(得分:0)
我正在考虑你正在使用Laravel应用程序。
尝试使用以下内容:
<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot “/Users/samir/Sites/theblog/public”
<Directory /Users/samir/Sites/theblog/public/>
Allow from all
</Directory>
ServerName theblog.dev
ServerAlias www.theblog.dev
ErrorLog "/usr/local/var/log/apache2/dummy-host2.example.com-error_log"
CustomLog "/usr/local/var/log/apache2/dummy-host2.example.com-access_log" common
</VirtualHost>