簡體   English   中英

Symfony Vhost無法正常工作?

[英]Symfony Vhost is not working?

我在Windows中使用XAMPP。我想為我的symfony項目設置虛擬主機,因此我已通過(httpd-vhosts.conf)文件將apache中的虛擬主機設置為:

# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:80

# This is the configuration for drberg.com
Listen 127.0.0.1:80

<VirtualHost 127.0.0.1:80>
  ServerName drberg.com.local
  DocumentRoot "D:/xampp/htdocs/DrBerg.com/web"
  DirectoryIndex index.php
  <Directory "D:/xampp/htdocs/DrBerg.com/web">
    AllowOverride All
    Allow from All
  </Directory>

  Alias /sf "D:/xampp/htdocs/DrBerg.com/web/sf"
  <Directory "D:/xampp/htdocs/DrBerg.com/web/sf">
    AllowOverride All
    Allow from All
  </Directory>
</VirtualHost>

所以當我通過手動鏈接訪問我的symfony項目時,它也無法打開任何東西,因此它會將我重定向到本地主機,例如:

http://localhost/DrBerg.com/web/

因此它將我重定向到:

http://localhost/xampp/

hosts (在WINDOWS / system32 / drivers / etc /中)中設置ServerName

127.0.0.1        drberg.com.local

(保存該文件后立即生效)

並指向:

http://drberg.com.local

(使用http://,因為有時chrome將地址發送到google.com,而不是去那里)

並且不要在ServerName中使用localhost ,因為XAMPP會過濾該單詞( 本地可以)。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM