0

I was check my web server in apache2 and when I run the next command I get this error:

   root@me:~# sudo systemctl status apache2
sudo: unable to resolve host me
● 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-07-10 16:08:46 EDT; 20min ago
     Docs: man:systemd-sysv-generator(8)
  Process: 9666 ExecStart=/etc/init.d/apache2 start (code=exited, status=2)

Jul 10 16:08:46 me systemd1: Starting LSB: Apache2 web server... Jul 10 16:08:46 me apache2[9666]: /etc/init.d/apache2: 46: .: Can't open /etc/apache2/envvars Jul 10 16:08:46 me apache2[9666]: /etc/init.d/apache2: 57: .: Can't open /etc/apache2/envvars Jul 10 16:08:47 me apache2[9666]: ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars Jul 10 16:08:46 me systemd1: apache2.service: Control process exited, code=exited status=2 Jul 10 16:08:46 me systemd1: Failed to start LSB: Apache2 web server. Jul 10 16:08:46 me systemd1: apache2.service: Unit entered failed state. Jul 10 16:08:46 me systemd1: apache2.service: Failed with result 'exit-code'. root@me:~#

I run this command :

sudo systemctl status apache2

I saw this two part from request:

Jul 10 16:08:46 me systemd[1]: Failed to start LSB: Apache2 web server.

and

Jul 10 16:08:47 me apache2[9666]: ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars

my question are why I have this error and are they something bad for me server , because I have two client in this server?

my version for me apache and linux:

root@me:~# apache2 -v

Server version: Apache/2.4.18 (Ubuntu) Server built: 2017-06-07T19:43:03 root@me:~#

and

Linux me 4.15.0-24-generic #26~16.04.1-Ubuntu SMP Fri Jun 15 14:35:08 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

root@m

I am beginner in apache2

from this tutorial

2

The first error message returned from your systemctl command is:

sudo: unable to resolve host me

As stated by roaima, the use of sudo is pointless, because you're already root and have all neccessary access rights as such. The sudo command can be used to acquire root rights, while you're logged in as an user.

The second error message returned from your systemctl command is:

/etc/init.d/apache2: 46: .: Can't open /etc/apache2/envvars

The /etc/apache2/envvars file is not available or you should provide access to it. Please check if the file is available first with the ls -l command. If the file exists, you should probably use the chown or chmod command to provide access.

The same question is answered here on stackoverflow . You can find further instructions to create an initial apache envvars configuration file by following the link.

  • Also bear in mind that the use of sudo is totally pointless in the OP's command set, because they are already root. – roaima Jul 10 '18 at 22:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.