我試圖在localhost上設置一個虛擬主機。我在我的Ubuntu 12.04 LTS上安裝了symfony 1.4,但是我遇到了一些問題。apache2和virtualhost的問題
我安裝了apache2,php5和mySql。本地主機的作品,所以我認爲阿帕奇沒關係。
你可以找到symfony的安裝和配置說明here。
幾天後,這是我的配置文件:
的http.conf:
ServerName 127.0.0.1
的/ etc/apache2的/網站可用/測試:
# Be sure to only have this line once in your configuration
NameVirtualHost 127.0.0.1:8080
# This is the configuration for your project
Listen 127.0.0.1:8080
<VirtualHost 127.0.0.1:8080>
DocumentRoot "/home/user/test/web"
DirectoryIndex index.php
<Directory "/home/user/test/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /home/user/test/lib/vendor/symfony/data/web/sf
<Directory "/home/user/test/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
和本地主機:8080不起作用。
UPDATE: 好吧,經過多次修改,我的httpd.conf是一樣的:
ServerName 127.0.0.1
而且我的/ etc/apache2的/網站可用/測試:
Listen 127.0.0.1:80
<VirtualHost 127.0.0.1:80>
DocumentRoot "/home/user/test/web"
DirectoryIndex index.php
<Directory "/home/user/test/web">
AllowOverride All
Allow from All
</Directory>
Alias /sf /home/user/test/lib/vendor/symfony/data/web/sf
<Directory "/home/user/test/lib/vendor/symfony/data/web/sf">
AllowOverride All
Allow from All
</Directory>
</VirtualHost>
是否在端口80或8080的運行Apache? (檢查'ports.conf') – j0k
你有沒有嘗試給所有目錄的物理路徑?其他人似乎沒問題。 – qais
@ j0k我在端口80上運行Apache。'NameVirtualHost *:80 Listen 80' – jhrs21