如何在 18.04 中启用 URL 重写?

如何在 18.04 中启用 URL 重写?

正在安装 spicecrm,实例正在请求配置 URL 重写。为了允许 crm 运行,我已将 php 版本“降级”到 7.1,并从 Ubuntu 18.04 中删除了 7.0 和 7.2,因为残留的配置让我很头疼。

现在需要配置 URL 重写,并且数字海洋建议添加:

    <VirtualHost *:80>
        <Directory /var/www/html>
            Options Indexes FollowSymLinks MultiViews
            AllowOverride All
            Require all granted
        </Directory>

000-default.conf文件

重新启动时,Apache 服务器提供以下状态输出:

● apache2.service - The Apache HTTP Server
   Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enab
  Drop-In: /lib/systemd/system/apache2.service.d
           └─apache2-systemd.conf
   Active: failed (Result: exit-code) since Sun 2018-09-09 22:56:16 CEST; 19s ago
  Process: 10530 ExecStop=/usr/sbin/apachectl stop (code=exited, status=1/FAILURE)
  Process: 7153 ExecReload=/usr/sbin/apachectl graceful (code=exited, status=0/SUCCE
  Process: 10574 ExecStart=/usr/sbin/apachectl start (code=exited, status=1/FAILURE)
 Main PID: 10498 (code=exited, status=0/SUCCESS)


Sep 09 22:56:16 mavezaCRM4 systemd[1]: Starting The Apache HTTP Server...
Sep 09 22:56:16 mavezaCRM4 systemd[1]: apache2.service: Control process exited, code
Sep 09 22:56:16 mavezaCRM4 apachectl[10574]: apache2: Syntax error on line 225 of /e
Sep 09 22:56:16 mavezaCRM4 systemd[1]: apache2.service: Failed with result 'exit-cod
Sep 09 22:56:16 mavezaCRM4 apachectl[10574]: Action 'start' failed.
Sep 09 22:56:16 mavezaCRM4 apachectl[10574]: The Apache error log may have more info
Sep 09 22:56:16 mavezaCRM4 systemd[1]: Failed to start The Apache HTTP Server.
lines 1-17/17 (END)

我将非常感激任何关于我在此过程中遗漏内容的建议。

$ journalctl -lxeu apache2.service
-- Unit apache2.service has finished reloading its configuration
--
-- The result is RESULT.
Sep 10 20:02:12 mavezaCRM4 systemd[1]: Stopping The Apache HTTP Server...
-- Subject: Unit apache2.service has begun shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit apache2.service has begun shutting down.
Sep 10 20:02:12 mavezaCRM4 apachectl[15171]: apache2: Syntax error on line 225 o
Sep 10 20:02:12 mavezaCRM4 apachectl[15171]: Action 'stop' failed.
Sep 10 20:02:12 mavezaCRM4 apachectl[15171]: The Apache error log may have more
Sep 10 20:02:12 mavezaCRM4 systemd[1]: apache2.service: Control process exited,
Sep 10 20:02:12 mavezaCRM4 systemd[1]: apache2.service: Failed with result 'exit
Sep 10 20:02:12 mavezaCRM4 systemd[1]: Stopped The Apache HTTP Server.
-- Subject: Unit apache2.service has finished shutting down
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support  
--
-- Unit apache2.service has finished shutting down.
Sep 10 20:02:12 mavezaCRM4 systemd[1]: Starting The Apache HTTP Server...
-- Subject: Unit apache2.service has begun start-up
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit apache2.service has begun starting up.
Sep 10 20:02:12 mavezaCRM4 apachectl[15176]: apache2: Syntax error on line 225 o
Sep 10 20:02:12 mavezaCRM4 apachectl[15176]: Action 'start' failed.
Sep 10 20:02:12 mavezaCRM4 apachectl[15176]: The Apache error log may have more
Sep 10 20:02:12 mavezaCRM4 systemd[1]: apache2.service: Control process exited,
Sep 10 20:02:12 mavezaCRM4 systemd[1]: apache2.service: Failed with result 'exit
Sep 10 20:02:12 mavezaCRM4 systemd[1]: Failed to start The Apache HTTP Server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://www.ubuntu.com/support
--
-- Unit apache2.service has failed.
--
-- The result is RESULT.
lines 615-653/653 (END)

答案1

答案被编辑,不再涉及问题

@David:在您的指导和命令--no-pager中的开关的帮助下journalctl,我找到了罪魁祸首。一个愚蠢的行为,在尝试使事情正常工作时,我/在关闭 Directory 命令前丢失了 。然后,在确定服务器的完全限定服务器名称时出现了新的投诉(通过将.conf文件添加到conf-available目录并使用 激活它来修复a2enconf)。此时,我已干净地启动了 Apache2。然后遵循 Digital Ocean 协议,使用.htaccess命令 向 web-root 添加文件RewriteEngine on。现在一切都在运行!

相关内容