[英]vhost config for Zend Framework 2 in Xampp (windows)
我已經在xamp(Windows)中安裝了zend framework 2,並且在我調用http://localhost/zf2-tutorial/public/
時可以訪問它。 我正在嘗試使用httpd-vhosts.conf
使用以下配置來設置虛擬主機
<VirtualHost *:80>
ServerName zf2-tutorial.localhost
DocumentRoot "D:/xampp/htdocs/zf2-tutorial/public"
SetEnv APPLICATION_ENV "development"
<Directory D:/xampp/htdocs/zf2-tutorial/public>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
並已在主機文件中配置127.0.0.1 zf2-tutorial.localhost
。 但是當我在瀏覽器中調用zf2-tutorial.localhost
時,我得到的只是http://zf2-tutorial.localhost/xampp/
。 我還嘗試將其添加到httpd.conf
,結果仍然相同。 請幫忙 ?
如果您在文件httpd-vhost.com
配置虛擬主機,請確保在httpd.conf文件中未注釋虛擬主機包含文件,即從Include conf/extra/httpd-vhosts.conf
行的開頭刪除#。
我個人不喜歡xammp軟件,而是設置我自己的apache,但是設置項目應該不會有太多差異。 我還喜歡為項目使用別名,而不是通過“ localhost”或“ ip”訪問它們。 我的配置通常看起來像這樣:
<VirtualHost *:80>
ServerName tutorial.local
ServerAlias tutorial.local
DocumentRoot c:/Apache24/htdocs/tutorial/public/
SetEnv APPLICATION_ENV "development"
<Directory c:/Apache24/htdocs/tutorial/public/>
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
在使用別名設置虛擬主機之后,您必須在FILESYSTEM:\\windows\\System32\\drivers\\etc\\
打開主機文件並添加主機。
localhost or IP tutorial.local
請記住,您將必須以管理員身份打開此文件,並且可能會禁用防病毒/間諜阻止程序。
我終於找到了問題所在,我從未為本地主機添加虛擬主機。 一次,我像這樣在httpd-vhost.cong中配置了本地主機,它運行良好。 感謝你的幫助
<VirtualHost *:80>
DocumentRoot "D:\xampp\htdocs"
ServerName localhost
</VirtualHost>
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.