给出错误:“apache2.service 的作业失败,因为控制进程退出并显示错误代码。” 用于重新启动 apache2 时工作的虚拟主机

Shy*_*ali 2 server ssl virtualhost apache2

Job for apache2.service failed because the control process exited with error code. See "systemctl status apache2.service" and "journalctl -xe" for details.
Run Code Online (Sandbox Code Playgroud)

我的项目工作正常,今天早上我重新安装了 apache 和 php7.0。我在我的项目中使用了 ssl。当我从虚拟主机中删除 ssl 时,它工作正常。但是当我再次添加 ssl 时,它会出现上述错误。我已经尝试过针对上述错误给出的建议。非然后工作。谁能帮我。Thnak 你提前输出sudo systemctl status apache2.service

? 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 ?? 2017-04-21 08:35:19 +0530; 26s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 3776 ExecStop=/etc/init.d/apache2 stop (code=exited, status=0/SUCCESS)
  Process: 3114 ExecReload=/etc/init.d/apache2 reload (code=exited, status=0/SUCCESS)
  Process: 3802 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)

 ???<U+200D>?? 21 08:35:19 shyamali-pc apache2[3802]:  * The apache2 configtest failed.
 ???<U+200D>?? 21 08:35:19 shyamali-pc apache2[3802]: Output of config test was:
 ???<U+200D>?? 21 08:35:19 shyamali-pc apache2[3802]: AH00526: Syntax error on line 34 of /etc/apache2/sites-enabled/TestCodeIgniter.local.conf:
 ???<U+200D>?? 21 08:35:19 shyamali-pc apache2[3802]: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in t
 ???<U+200D>?? 21 08:35:19 shyamali-pc apache2[3802]: Action 'configtest' failed.
 ???<U+200D>?? 21 08:35:19 shyamali-pc apache2[3802]: The Apache error log may have more information.
 ???<U+200D>?? 21 08:35:19 shyamali-pc systemd[1]: apache2.service: Control process exited, code=exited status=1
 ???<U+200D>?? 21 08:35:19 shyamali-pc systemd[1]: Failed to start LSB: Apache2 web server.
 ???<U+200D>?? 21 08:35:19 shyamali-pc systemd[1]: apache2.service: Unit entered failed state.
 ???<U+200D>?? 21 08:35:19 shyamali-pc systemd[1]: apache2.service: Failed with result 'exit-code'.
Run Code Online (Sandbox Code Playgroud)

输出 sudo journalctl -xe

???<U+200D>?? 21 08:35:19 shyamali-pc systemd[1]: apache2.service: Control process exited, code=exited status=1
???<U+200D>?? 21 08:35:19 shyamali-pc systemd[1]: Failed to start LSB: Apache2 web server.
-- Subject: Unit apache2.service has failed
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit apache2.service has failed.
-- 
-- The result is failed.
???<U+200D>?? 21 08:35:19 shyamali-pc systemd[1]: apache2.service: Unit entered failed state.
???<U+200D>?? 21 08:35:19 shyamali-pc sudo[3770]: pam_unix(sudo:session): session closed for user root
???<U+200D>?? 21 08:35:19 shyamali-pc systemd[1]: apache2.service: Failed with result 'exit-code'.
???<U+200D>?? 21 08:35:45 shyamali-pc sudo[3822]: shyamali : TTY=pts/2 ; PWD=/home/shyamali ; USER=root ; COMMAND=/bin/systemctl status apache2.s
???<U+200D>?? 21 08:35:45 shyamali-pc sudo[3822]: pam_unix(sudo:session): session opened for user root by (uid=0)
???<U+200D>?? 21 08:36:46 shyamali-pc pkexec[3837]: pam_unix(polkit-1:session): session opened for user root by (uid=1000)
???<U+200D>?? 21 08:36:46 shyamali-pc pkexec[3837]: pam_systemd(polkit-1:session): Cannot create session: Already running in a session
???<U+200D>?? 21 08:36:46 shyamali-pc pkexec[3837]: shyamali: Executing command [USER=root] [TTY=unknown] [CWD=/home/shyamali] [COMMAND=/usr/lib/
???<U+200D>?? 21 08:37:17 shyamali-pc sudo[3822]: pam_unix(sudo:session): session closed for user root
???<U+200D>?? 21 08:39:01 shyamali-pc CRON[3859]: pam_unix(cron:session): session opened for user root by (uid=0)
???<U+200D>?? 21 08:39:01 shyamali-pc CRON[3860]: (root) CMD (  [ -x /usr/lib/php/sessionclean ] && /usr/lib/php/sessionclean)
???<U+200D>?? 21 08:39:02 shyamali-pc CRON[3859]: pam_unix(cron:session): session closed for user root
???<U+200D>?? 21 08:41:51 shyamali-pc AptDaemon[2213]: INFO: Quitting due to inactivity
???<U+200D>?? 21 08:41:51 shyamali-pc AptDaemon[2213]: INFO: Quitting was requested
???<U+200D>?? 21 08:41:51 shyamali-pc org.debian.apt[564]: 08:41:51 AptDaemon [INFO]: Quitting due to inactivity
???<U+200D>?? 21 08:41:51 shyamali-pc org.debian.apt[564]: 08:41:51 AptDaemon [INFO]: Quitting was requested
???<U+200D>?? 21 08:43:50 shyamali-pc systemd[1]: Starting Cleanup of        Temporary Directories...
-- Subject: Unit systemd-tmpfiles-clean.service has begun start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit systemd-tmpfiles-clean.service has begun starting up.
???<U+200D>?? 21 08:43:50 shyamali-pc systemd-tmpfiles[3943]: [/usr/lib/tmpfiles.d/var.conf:14] Duplicate line for path "/var/log", ignoring.
???<U+200D>?? 21 08:43:50 shyamali-pc systemd[1]: Started Cleanup of Temporary Directories.
-- Subject: Unit systemd-tmpfiles-clean.service has finished start-up
-- Defined-By: systemd
-- Support: http://lists.freedesktop.org/mailman/listinfo/systemd-devel
-- 
-- Unit systemd-tmpfiles-clean.service has finished starting up.
-- 
-- The start-up result is done.
???<U+200D>?? 21 08:44:53 shyamali-pc sudo[3950]: shyamali : TTY=pts/2 ; PWD=/home/shyamali ; USER=root ; COMMAND=/bin/journalctl -xe
???<U+200D>?? 21 08:44:53 shyamali-pc sudo[3950]: pam_unix(sudo:session): session opened for user root by (uid=0)
lines 1108-1149/1149 (END)
Run Code Online (Sandbox Code Playgroud)

注意:最近我安装了Skype,今天我已经漫游了。但问题还是一样。这些输出是在删除Skype之后

pa4*_*080 5

报告sudo systemctl status apache2.service显示:

Syntax error on line 34 of /etc/apache2/sites-enabled/TestCodeIgniter.local.conf:
Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in ...
Run Code Online (Sandbox Code Playgroud)

出于某种原因,Apache 的模块mod_rewrite被禁用。这个特定问题的解决方案是启用模块:

sudo a2enmod rewrite
sudo systemctl restart apache2.service
Run Code Online (Sandbox Code Playgroud)