2013-10-31 56 views
2

今天早些時候我剛剛升級到Ubuntu 13.10。 Apache2的版本現在是2.4.6。我刪除了舊的站點配置文件,並試圖創建一個新的。當我試圖複製default.conf時,我發現格式已經發生了顯着變化。這裏是一個新的conf文件的例子。由於很多人做的,我也有被禁止的問題,即使我把我的文件夾的權限爲777Apache 2.4.6的新網站conf文件

 1 <VirtualHost *:80> 
     2  # The ServerName directive sets the request scheme, hostname and port th at 
     3  # the server uses to identify itself. This is used when creating 
     4  # redirection URLs. In the context of virtual hosts, the ServerName 
     5  # specifies what hostname must appear in the request's Host: header to 
     6  # match this virtual host. For the default virtual host (this file) this 
     7  # value is not decisive as it is used as a last resort host regardless. 
     8  # However, you must set it for any further virtual host explicitly. 
     9  ServerName www.janicezhang.me 
    10 
    11  ServerAdmin [email protected] 
    12  DocumentRoot /home/yifan/www/janice 
    13 
    14  # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 
    15  # error, crit, alert, emerg. 
    16  # It is also possible to configure the loglevel for particular 
    17  # modules, e.g. 
    18  #LogLevel info ssl:warn 
    19 
    20  ErrorLog ${APACHE_LOG_DIR}/error.log 
    21  CustomLog ${APACHE_LOG_DIR}/access.log combined 
    22 
    23  # For most configuration files from conf-available/, which are 
    24  # enabled or disabled at a global level, it is possible to 
    25  # include a line for only one particular virtual host. For example the 
    26  # following line enables the CGI configuration for this host only 
    27  # after it has been globally disabled with "a2disconf". 
    28  #Include conf-available/serve-cgi-bin.conf 
    29 </VirtualHost> 

我只是想知道如果有一些toturial在Ubuntu設置虛擬主機的Apache 2.4.6 13.10。謝謝。

回答

3

好的,我自己解決了這個問題。有兩件事需要完成。 首先,添加在您的網站配置文件行是這樣的:

<Directory "/home/yifan/www/janice"> 
    Options ExecCGI 
    AllowOverride all 
    Require all granted 
</Directory> 

在此之後,我可以瀏覽到該網站沒有禁止的錯誤。但是,php文件顯示爲純文本。我檢查文件夾mods啓用,並發現php5不在這裏。我不知道爲什麼php5在升級過程中丟失了。所以只需重新安裝它

sudo apt-get install libapache2-mod-php5 

然後,網站被恢復。

+0

你的意思是說,我們應該自己添加號碼簿標籤?我遇到同樣的問題,基於Java的網站顯示爲純文本。對於以前版本的2.2.22版本的Apache,我需要在新版本的default.conf中設置3個目錄標籤。如果你更新你的答案,解釋2.4.6版本的default.conf中的新變化/添加,那將是非常好的。 – engineer

+0

@engineer是的,默認沒有標籤。所以,我認爲你必須手動添加一個。 –