2016-02-19 19 views
0

我(對親約塞米蒂10.10.5一臺MacBook運行),具有包括以下的hosts文件:點我的主機用戶/用戶名/從庫網站/ Web服務器/文件

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    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

與**了NameVirtualHost *啓用virtualhosts? –

+0

對不起?你是什​​麼意思,在哪裏? –

+0

Apache需要NameVirtualHost指令來啓用虛擬主機 –

回答

0

我在考慮你正在使用Laravel應用程序。

試試下面:80 **:

<VirtualHost *:80> 
    ServerAdmin [email protected] 
    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> 
相關問題