Ubuntu: Apache “Restart” not working



Question:

I install apache2 package and i run this command line from terminal and it getting me error like this

user@user:~$ sudo /etc/init.d/apache2 restart   sudo: /etc/sudoers.d is world writable  /etc/init.d/apache2: 64: .: Can't open /etc/apache2/envvars  /etc/init.d/apache2: 76: .: Can't open /etc/apache2/envvars  ERROR: APACHE_PID_FILE needs to be defined in /etc/apache2/envvars  

can anyone help me for this.


Solution:1

Did you accidentally changed permissions and/or ownership on the files envvars and sudoers.d? Because apache is not able to open the envvars file. Also the sudoers.d directory seems to have different permissions than when it was installed. Use the commands below to change permissions and ownership of the file and directory.

sudo chmod 755 /etc/sudoers.d  

User and group should be root - change like this:

sudo chown root: /etc/sudoers.d   

And for the envvars files

sudo chmod 644 /etc/apache2/envvars    sudo chown root: /etc/apache2/envvars  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »