【问题标题】:Invalid Command 'RewriteEngine' but mod_rewrite is enabled无效命令“RewriteEngine”但启用了 mod_rewrite
【发布时间】:2016-08-29 04:57:30
【问题描述】:

我正在用这个 conf file 建立一个 gitlab 站点

但是出现了这个错误:

Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

我已经从源代码安装了 apache 2.4.20。忘了我已经用apt-get 安装了2.4.7。现在apache -v 显示2.4.7

我遵循了很多解决方案,但它们都不起作用:

在 httpd.conf 文件中取消注释 LoadModule rewrite_module modules/mod_rewrite.so 行(从行前删除井号'#')

Apache2 ProxyPass for Rails App Gitlab

我检查了重写模块,它就在那里; a2enmod rewrite 已启用,service apache2 restart 在没有 gitlab.conf 文件的情况下工作。

但是用gitlab.conf,会出现这个错误Invalid command 'RewriteEngine'

【问题讨论】:

  • 条件和规则应该用在Directory 上下文中,而不是VirtualHost 上下文中。我从未在Location 上下文中尝试过,所以我不知道会产生什么结果。

标签: apache .htaccess gitlab


【解决方案1】:

我在使用 Vagrant 设置虚拟机时遇到了同样的问题。
我终于通过在 Vagrantfile 配置中为客户端设置 ip 解决了这个问题:

config.vm.network :private_network, ip: "192.168.68.8"

然后添加到本地/etc/hosts文件中:

192.168.68.8    namespace.dev

【讨论】:

    猜你喜欢
    • 2016-09-01
    • 2016-07-05
    • 2022-01-23
    • 2016-10-04
    • 2018-04-11
    • 1970-01-01
    • 2016-12-21
    • 2016-02-16
    相关资源
    最近更新 更多