今天我上傳了我的Zend框架1個Web項目到我的網絡服務器(Debian的)與在其上運行的Apache2。Zend框架1周的Apache2虛擬主機配置
我開發與XAMPP Mac上的項目。 我複製的配置,虛擬主機和的.htaccess文件。
vhost (/etc/apache2/sites-available/***.***.de.conf)
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
ServerName ****.****.de
ServerAdmin ******@******.com
DocumentRoot /var/www/****.****.de/public_html
# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
# For most configuration files from conf-available/, which are
# enabled or disabled at a global level, it is possible to
# include a line for only one particular virtual host. For example the
# following line enables the CGI configuration for this host only
# after it has been globally disabled with "a2disconf".
#Include conf-available/serve-cgi-bin.conf
SetEnv APPLICATION_ENV "development"
<Directory /var/www/****.****.de/public_html>
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
</Directory>
的.htaccess(中的public_html)
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -s [OR]
RewriteCond %{REQUEST_FILENAME} -l [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^.*$ - [NC,L]
RewriteRule ^.*$ index.php [NC,L]
這是我從許多不同來源和搜索時間這個工作對我的本地開發環境之後得到。當我打開網站時,我可以看到開始頁面。但是控制器調用不起作用(索引控制器除外)。我總是得到錯誤「未找到」。
在/etc/apache2/ports.conf我加
NameVirtualHost *:80
當然,我已經通過a2ensite添加的網站,並重新啓動的Apache2 web服務器。 有人可以幫我嗎?
檢查重寫模塊在Apache中啓用('大概a2enmod rewrite'),並重新啓動再 – rjdown
我沒有檢查這一點,但能夠重寫模塊後,仍不能正常工作(同樣的錯誤與以前一樣)。 – hapablap
OK,現在我試圖以測試的.htaccess甚至工作,並增加了一個永久重定向(重寫規則* HTTP://www.neuedomain.tld/ [L,R = 301]),但它不工作。所以似乎.htaccess甚至沒有被使用? – hapablap