【发布时间】:2021-06-07 08:52:44
【问题描述】:
大家好。我在这里问这个问题是最后的手段,因为我已经尝试解决这个问题将近两天了。
我正在尝试在我的 Drupal Web 应用程序上启用干净的 URL。我已经访问了 几个 公开问题,例如 this 一个,但无济于事。如果这是转发,我最诚挚的歉意。
一些(相关的)上下文:
- 该项目涉及使用 Vagrant 脚本自动设置 VM。
- 虚拟机没有 GUI。
- Vagrant 使用 VirtualBox。
- Vagrant 使用 bento/centos-7.9 作为基础 box。
- 每当我需要终端来执行 PS 或 Linux 命令时,我都会在我的物理设备上使用 WSL。
我正在使用以下方法在 VM 上设置 LAMP 堆栈:
- CentOS 7.9,如上所述。
- Apache 2.4.6,如:
yum -y install httpd
- MariaDB 10.5.9,如:
wget https://downloads.mariadb.com/MariaDB/mariadb_repo_setup
chmod +x mariadb_repo_setup
./mariadb_repo_setup
yum -y install mariadb-server
- PHP 7.4.16,如:
yum -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
yum -y install https://rpms.remirepo.net/enterprise/remi-release-7.rpm
yum-config-manager --enable remi-php74
yum -y install php php-mysql
-
我正在存储 Drupal 的提取内容(index.php、update.php、 核心,站点...)在
/var/www/drupal/下。我给了阿帕奇 该文件夹的递归所有权,以免产生设置权限的麻烦。无论如何,这不是一个生产项目。 -
在
/etc/httpd/conf/httpd.conf文件中,我只触及了 DocumentRoot,我将其设置为DocumentRoot "/var/www/drupal"。我确实不想使用 .htaccess。 -
当我运行
httpd -M | grep rewrite时,我收到输出 rewrite_module (shared)。当我在测试页面上运行phpinfo();时,加载的模块中存在 mod_rewrite。
运行应用程序,一切正常,并产生以下输出:
我知道另外两个警告,但这些是另一天的担忧。当我不顾警告继续时,Apache 加载 index.php 就好了:
但是,当我点击任何按钮时,就会发生这种情况:
Screenshot of yet another problem
我怀疑这是未启用干净 URL 的结果。但是,据我所知,所有必要的模块都已安装。
到目前为止我所做的尝试:
- 在
/etc/httpd/conf/httpd.conf中,尝试here 建议的所有内容。 - 在
/etc/httpd/conf/httpd.conf中,将每个AllowOverride 选项设置为All。 - 检查兼容性问题。
- 移动文档根目录。
- 更多...
我们将不胜感激。提前谢谢了。如果您需要更多信息,我会尽快回复。
【问题讨论】:
标签: linux apache drupal centos clean-urls