Problem apache server (re-)Installation

8,220

Solution 1

finally i got the solution

sudo service apache2 stop
sudo apt-get remove --purge $APACHE_PKGS
sudo apt-get install --reinstall apache2

Solution 2

Open your terminal and type this

sudo apt-get install --reinstall apache2
Share:
8,220

Related videos on Youtube

Gabber
Author by

Gabber

Updated on September 18, 2022

Comments

  • Gabber
    Gabber almost 2 years

    I am newbie in Ubuntu and I removed all apache file following command

    sudo chown user /etc/init.d/apache2
    sudo chmod 755 /etc/init.d/apache2
    sudo rm /etc/init.d/apache2 
    

    I know its wrong way to removing apache, now I want to install apache again

    Edit try to reinstal apache

    sudo apt-get install --reinstall apache2
    

    working fine,but when I type command

    sudo service apache2 start
    

    response as,

    apache2: unrecognized service
    
  • Gabber
    Gabber about 10 years
    command is working fine,but "sudo service apache2 start" giving me error "apache2: unrecognized service"
  • AzkerM
    AzkerM about 10 years
    @AmitDubey - Confirm whether your apache2 service is installed by checking with dpkg --get-selections | grep -v deinstall | grep "apache2". This will give you an output if the packages in installed.
  • Gabber
    Gabber about 10 years
    @AzkerM thanks for reply,command out put is "apache2=>install" "apache2-bin=>install", "apache2-data=>install"
  • AzkerM
    AzkerM about 10 years
    seems like you've the packages in place. Try sudo /etc/init.d/apache2 reload or sudo apache2ctl graceful to have a look through again.
  • AzkerM
    AzkerM about 10 years
    Good to hear! :)
  • mx7
    mx7 about 10 years
    glad you have found that and thanks for adding . it will be useful for future reference.
  • reggie
    reggie over 8 years
    Did not solve the problem.
  • Gabber
    Gabber over 8 years
    @reggie it worked for me