首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >Apache重写模式破坏apache

Apache重写模式破坏apache
EN

Server Fault用户
提问于 2017-04-03 18:25:08
回答 1查看 470关注 0票数 1

我正在设置Drupal,在配置的中途接收一个错误:

干净的Urls必须可用并启用才能使用OpenAtrium。

https://www.drupal.org/docs/7/configuring-clean-urls/enable-clean-urls告诉我运行sudo a2enmod rewrite,这种情况会发生:

代码语言:javascript
运行
复制
Enabling module rewrite.
To activate the new configuration, you need to run:
service apache2 restart

但是,当我运行sudo service apache2 restart时,我会得到以下错误:

代码语言:javascript
运行
复制
Job for apache2.service failed because the control process exited with error code. 
See "systemctl status apache2.service" and "journalctl -xe" for details.

systemctl status apache2.service返回:

代码语言:javascript
运行
复制
● apache2.service - LSB: Apache2 web server
Loaded: loaded (/etc/init.d/apache2; bad; vendor preset: enabled)
Drop-In: /lib/systemd/system/apache2.service.d
       └─apache2-systemd.conf
 Active: failed (Result: exit-code) since Mon 2017-04-03 18:21:04 UTC; 7s ago
 Docs: man:systemd-sysv-generator(8)
Process: 11268 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
Process: 11345 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

Apr 03 18:21:04 ip-172-31-31-251 apache2[11345]:  *
Apr 03 18:21:04 ip-172-31-31-251 apache2[11345]:  * The apache2 configtest failed.
Apr 03 18:21:04 ip-172-31-31-251 apache2[11345]: Output of config test was:
Apr 03 18:21:04 ip-172-31-31-251 apache2[11345]: apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/rew
Apr 03 18:21:04 ip-172-31-31-251 apache2[11345]: Action 'configtest' failed.
Apr 03 18:21:04 ip-172-31-31-251 apache2[11345]: The Apache error log may have more information.
Apr 03 18:21:04 ip-172-31-31-251 systemd[1]: apache2.service: Control process exited, code=exited status=1
Apr 03 18:21:04 ip-172-31-31-251 systemd[1]: Failed to start LSB: Apache2 web server.
Apr 03 18:21:04 ip-172-31-31-251 systemd[1]: apache2.service: Unit entered failed state.
Apr 03 18:21:04 ip-172-31-31-251 systemd[1]: apache2.service: Failed with result 'exit-code'.

这个问题用a2dismod rewrite自己解决了,但是我又回到了我开始的地方。

我的/etc/apache2/mods-enabled/rewrite.load看起来像这样,如果这是麻烦的话。

代码语言:javascript
运行
复制
LoadModule rewrite_module modules/mod_rewrite.so

我如何才能让重写模式与apache一起工作?

EN

回答 1

Server Fault用户

发布于 2017-04-03 19:17:24

最后,通过使用sudo apache2ctl graceful并遵循错误消息中的文件链接解决了这一问题,例如:

代码语言:javascript
运行
复制
apache2: Syntax error on line 140 of /etc/apache2/apache2.conf: Syntax error on line 1 of /etc/apache2/mods-enabled/rewrite.load: LoadModule takes two arguments, a module name and the name of a shared object file to load it from
Action 'graceful' failed.
The Apache error log may have more information.

最后,我将AddModule mod_rewrite.c德鲁帕尔建议的rewrite.load中删除,并将链接从modules/mod_rewrite.so更改为/usr/lib/apache2/modules/mod_rewrite.so,这是它的实际位置(与sudo find / -name mod_rewrite.so一起找到的)。

然后我重新启动apache,一切都成功了!

票数 2
EN
页面原文内容由Server Fault提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://serverfault.com/questions/842312

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档