Php 驾驶舱CMS赢得';安装后Apache无法提供服务(404错误)
我正在尝试让驾驶舱CMS()在Ubuntu 16.04服务器上运行。文件是有限的。我已经在Apache文档根目录下的Php 驾驶舱CMS赢得';安装后Apache无法提供服务(404错误),php,apache,ubuntu,Php,Apache,Ubuntu,我正在尝试让驾驶舱CMS()在Ubuntu 16.04服务器上运行。文件是有限的。我已经在Apache文档根目录下的/var/www/html/root/cms中放置了驾驶舱文件夹 在website.com/cms/install上找到的安装页面工作正常。此页面现在重定向到website.com/cms/auth/login,但找不到(404错误)website.com/cms也重定向到/cms/auth/login 目录/var/www/html/root/cms/auth/login不存在(
/var/www/html/root/cms
中放置了驾驶舱文件夹
在website.com/cms/install
上找到的安装页面工作正常。此页面现在重定向到website.com/cms/auth/login
,但找不到(404错误)website.com/cms
也重定向到/cms/auth/login
目录/var/www/html/root/cms/auth/login
不存在(与本地目录相同)。所有内容都使用MAMP在本地环境中工作,使用相同的目录结构
Apache日志有以下错误,但我认为这与此无关:
服务器证书不包含与服务器名称匹配的ID
我已经尝试配置Apache并给/cms/
一个指向目录的别名。我还更改了/var/www/html/root/cms/
目录上的权限,以便所有文件都可读
我已尝试将DocumentRoot更改为/var/www/html2/
。这个目录中只有cms
文件夹。这并没有什么不同,在请求website.com/cms/auth/login
我不认为这是一个依赖问题。Php版本是7.0。已安装PDO+SQLite。已安装php7.0-gd。mod_rewrite也已启用 以下是我的站点启用配置文件:
<VirtualHost *:80>
Redirect / https://website.com/
</VirtualHost>
<VirtualHost *:443>
# 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 www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www/html/root
# 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 SSLCertificateChainFile /usr/local/ssl/crt/intermediate.crt
SSLEngine on
SSLCertificateFile /usr/local/ssl/crt/public.crt
SSLCertificateKeyFile /usr/local/ssl/crt/website.key
SSLCertificateChainFile /usr/local/ssl/crt/intermediate.crt
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
Alias /alternate/ "/var/www/html/alternate/"
<Directory "/var/www/html/alternate/">
</Directory>
Alias /root/ "/var/www/html/root/"
<Directory "/var/www/html/root/">
</Directory>
</VirtualHost>
# vim: syntax=apache ts=4 sw=4 sts=4 sr noet
重定向/https://website.com/
#ServerName指令设置请求方案、主机名和端口
#服务器使用来标识自身。这在创建时使用
#重定向URL。在虚拟主机的上下文中,服务器名
#指定必须在请求的主机:标头中显示的主机名
#匹配此虚拟主机。对于默认虚拟主机(此文件),此
#该值不是决定性的,因为它被用作最后的宿主。
#但是,必须为任何其他虚拟主机显式设置它。
#服务器名www.example.com
服务器管理员webmaster@localhost
DocumentRoot/var/www/html/root
#可用日志级别:trace8、…、trace1、调试、信息、通知、警告、,
#错误、暴击、警报、紧急情况。
#还可以为特定应用程序配置日志级别
#模块,例如。
#日志级别信息SSLCertificateChainFile/usr/local/ssl/crt/intermediate.crt
斯伦金安
SSLCertificateFile/usr/local/ssl/crt/public.crt
SSLCertificateKeyFile/usr/local/ssl/crt/website.key
SSLCertificateChainFile/usr/local/ssl/crt/intermediate.crt
ErrorLog${APACHE_LOG_DIR}/error.LOG
CustomLog${APACHE\u LOG\u DIR}/access.LOG组合
#对于conf/available/中的大多数配置文件
#在全局级别启用或禁用,可以
#仅包含一个特定虚拟主机的行。例如
#以下行仅为此主机启用CGI配置
#在使用“A2F”全局禁用后。
#包括conf available/service-cgi-bin.conf
别名/alternate/“/var/www/html/alternate/”
别名/root/“/var/www/html/root/”
#vim:syntax=apachets=4sw=4sts=4srnoet
修复它,您可以在控制台中:
sudo a2enmod rewrite
sudo service apache2 restart
install/index.php
确实存在于磁盘上,所以只要Apache和php正常工作,您就可以访问该文件,而无需任何特殊的服务器配置。你就是这样到的,好吧
然而,一旦安装,caffick依赖于.htaccess
中指定的重定向规则将磁盘上不存在的auth/login
等URL路由到适当的真实文件进行处理。如果失败,则意味着重写规则不起作用,您需要对此进行设置
首先,确保启用了mod_rewrite
。在Ubuntu上,您应该可以这样做:
sudo a2enmod rewrite
接下来,您需要确保启用了.htaccess
文件处理-如果未启用,则忽略.htaccess
文件(如驾驶舱目录中的文件)。将以下部分添加到虚拟主机配置的VirtualHost
块中(可能类似于/etc/apache2/sites available/website.conf
):
重新启动Apache以使这些更改生效:
sudo systemctl restart apache2
我不认为这是一个依赖问题。Php版本是7.0。已安装PDO+SQLite。已安装php7.0-gd。mod_rewrite也被启用。@matthewninja你能显示apache站点启用的配置文件吗?Vasya Zhuryk我已经用站点启用的文件更新了我的帖子。我还更新了路径。我知道配置看起来很奇怪。我还尝试将cms放在
html
文件夹中,并使用html
作为基本目录。这没什么区别,这应该不难。删除您的别名
es,删除2个空的目录
块。添加一个ServerName
。将DocumentRoot
指向/var/www/html/root/cms
(位于README.md
的目录)。重新启动Apache。请确保您的存储
目录是可写的。@不要担心,非常感谢您的回复。我已经做了所有这些,但错误仍然存在。还有什么原因?我已经用另一个关键步骤添加了一个答案-这有帮助吗?通过在目录标记中添加AllowOverride All
,我的问题得到了解决。
# The Directory should be where Cockpit's README.md is
<Directory "/var/www/html/root/cms">
AllowOverride All
</Directory>
<VirtualHost *:80>
Redirect / https://website.com/
</VirtualHost>
<VirtualHost *:443>
# Add your real, fully-qualified servername
ServerName www.example.com
ServerAdmin webmaster@localhost
# The Directory should be where Cockpit's README.md is
DocumentRoot /var/www/html/root/cms
# The Directory should be where Cockpit's README.md is
<Directory "/var/www/html/root/cms">
AllowOverride All
</Directory>
SSLEngine on
SSLCertificateFile /usr/local/ssl/crt/public.crt
SSLCertificateKeyFile /usr/local/ssl/crt/website.key
SSLCertificateChainFile /usr/local/ssl/crt/intermediate.crt
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
sudo systemctl restart apache2