Zend Framework 1 apache2 vhost配置

时间:2015-06-22 00:08:29

标签: php apache .htaccess zend-framework apache2

今天我将我的Zend Framework 1 web项目上传到我的web服务器(debian)上,并运行了apache2。

我用XAMPP在Mac上开发了这个项目。 我将配置复制到vhost和.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服务器。 有人能帮帮我吗?

1 个答案:

答案 0 :(得分:1)

因此,在认识到.htaccess甚至无法工作之后(通过简单地设置重定向到任何域),我找到了解决方案:

打开/etc/apache2/apache2.conf并编辑/ var / www的目录设置如下:

// Turn the above arrays into XYSeries':
XYSeries series1 = new SimpleXYSeries(Arrays.asList(s1),SimpleXYSeries.ArrayFormat.Y_VALS_ONLY,"Series1");
LineAndPointFormatter series1Format = new LineAndPointFormatter(Color.RED, Color.GREEN, Color.BLUE, null);

// add a new series' to the xyplot:
plot.addSeries(series1, series1Format);

// reduce the number of range labels
plot.setTicksPerRangeLabel(3);
plot.getGraphWidget().setDomainLabelOrientation(-45);

重启apache

<Directory /var/www/>
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

我不确定这是否是一个很好的解决方案,但对我来说它是有效的。