Question

Job for apache2.service failed because the control process exited with error code

Output of systemctl status apache2.service Job for apache2.service failed because the control process exited with error code. See “systemctl status apache2.service” and “journalctl -xe” for details.

root@essayszone:~# 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 Tue 2018-08-14 12:05:37 UTC; 4min 4s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 8147 ExecStart=/etc/init.d/apache2 start (code=exited, status=1/FAILURE)
Aug 14 12:05:37 essayszone.example.com apache2[8147]:  * The apache2 configtest failed.
Aug 14 12:05:37 essayszone.example.com apache2[8147]: Output of config test was:
Aug 14 12:05:37 essayszone.example.com apache2[8147]: AH00526: Syntax error on line 1 of /home/admin/conf/web/essayszone.com.apache2.ssl.conf:
Aug 14 12:05:37 essayszone.example.com apache2[8147]: Invalid command 'nano', perhaps misspelled or defined by a module not included in the server configuration
Aug 14 12:05:37 essayszone.example.com apache2[8147]: Action 'configtest' failed.
Aug 14 12:05:37 essayszone.example.com apache2[8147]: The Apache error log may have more information.
Aug 14 12:05:37 essayszone.example.com systemd[1]: apache2.service: Control process exited, code=exited status=1
Aug 14 12:05:37 essayszone.example.com systemd[1]: Failed to start LSB: Apache2 web server.
Aug 14 12:05:37 essayszone.example.com systemd[1]: apache2.service: Unit entered failed state.
Aug 14 12:05:37 essayszone.example.com systemd[1]: apache2.service: Failed with result 'exit-code'.
root@essayszone:~#
Output of sudo apache2ctl configtest
root@essayszone:~# apache2ctl configtest
AH00526: Syntax error on line 1 of /home/admin/conf/web/essayszone.com.apache2.ssl.conf:
Invalid command 'nano', perhaps misspelled or defined by a module not included in the server configuration
Action 'configtest' failed.
The Apache error log may have more information.

Submit an answer


This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

KFSys
Site Moderator
Site Moderator badge
September 26, 2023

It seems like there is a syntax error in your Apache configuration file /home/admin/conf/web/essayszone.com.apache2.ssl.conf. The error specifically mentions an invalid command nano, which suggests that somehow the command to open the nano text editor got included in the configuration file itself.

Solution

  1. Edit the Configuration File Open the mentioned configuration file in a text editor such as nano:
sudo nano /home/admin/conf/web/essayszone.com.apache2.ssl.conf
  1. Locate and Remove the Invalid Command Check the file and look for any line that starts with nano and remove it or correct it. Nano is a text editor and should not be part of the configuration. Save the file after correcting it.

    • Press CTRL + X to close the editor.
    • Press Y to confirm changes, and press Enter to save.
  2. Run Configtest Again After making the changes, run the configtest again to see if there are any more issues:

sudo apache2ctl configtest

If it returns Syntax OK, you can proceed to restart Apache.

  1. Restart Apache Finally, restart the Apache service:
sudo systemctl restart apache2

If Apache fails to start, please check the error message and adjust the configuration file as needed.

Additional Tip

While editing configuration files, be cautious to only edit the necessary lines to avoid introducing syntax errors. Always run a configuration test after editing before restarting the service to ensure the syntax is correct.

jarland
DigitalOcean Employee
DigitalOcean Employee badge
August 15, 2018

Hello friend!

It looks like there exists some bad configuration syntax in /home/admin/conf/web/essayszone.com.apache2.ssl.conf. This line is the key:

Aug 14 12:05:37 essayszone.example.com apache2[8147]: Invalid command ‘nano’, perhaps misspelled or defined by a module not included in the server configuration

Look for the word “nano” where it shouldn’t be, try removing that and see if that has you in working order :)

Kind Regards, Jarland

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We'd like to help.

Become a contributor

Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.

Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow — whether you're running one virtual machine or ten thousand.

Learn more
DigitalOcean Cloud Control Panel