Apache2.conf cannot be found, and how to delete Apache from APT-Get install apache2

Source: Internet
Author: User
Tags fully qualified domain name

The reason is that Apache and Apache installed with APT-Get install coexist on my local machine, and the current service apache2 start prompt cannot find apache2.conf, there are also various problems, so I want to completely delete the apache2.

Error message: file/etc/apache2/apache2.conf: no such file or directory.

Next, start uninstalling:

If you have dpkg, you can directly execute it. If not, you can install it with APT-get:

Dpkg-P apache2

Dpkg-P apache2-common

Dpkg-P apache2-utils

Dpgk-P apache2.2-common

Dpkg-P apache2-mpm-worker

The system prompts all levels of dependencies during the deletion process. You can delete them in reverse order.

After deleting all these items, try:

Apt-Get remove apache2

Dpkg-P apache2

If the message is deleted, You can reinstall apache2: APT-Get install apache2.

After installation, check again:

Drwxr-XR-x 7 Root 4096 August 16 10:10 ./
Drwxr-XR-x 154 Root 12288 August 16 10:09 ../
-RW-r -- 1 Root 9359 August July 16 2012 apache2.conf
Drwxr-XR-x 2 root Root 4096 August 16 10:10 Conf. d/
-RW-r -- 1 Root 1322 August July 16 2012 envvars
-RW-r -- 1 Root 31063 July 16 2012 magic
Drwxr-XR-x 2 root Root 4096 August 16 10:10 mod-available/
Drwxr-XR-x 2 root Root 4096 August 16 10:10 mod-enabled/
-RW-r -- 1 Root 750 July 16 2012 ports. conf
Drwxr-XR-x 2 root Root 4096 August 16 10:10 sites-available/
Drwxr-XR-x 2 root Root 4096 August 16 10:10 sites-enabled/

This has finally appeared ~~

Reference: http://linux.chinaunix.net/techdoc/net/2006/11/11/943794.shtml

Then we start apache2:

Apache2-K start

Tip: apache2: Bad user name $ {apache_run_user}

Specific solutions can refer to: http://blog.csdn.net/kongxx/article/details/5708427

Next we will try again, instead of starting with a script, in the form of starting the service:

Service apache2 start

An error is prompted:

Apache2: cocould not reliably determine the server's fully qualified domain name, using 127.0.1.1 for servername
Httpd (PID 8889) already running

OK, let's modify:

/Etc/apache2/apache2.conf

Add:

Servername localhost

After restarting apache2 again, no error message is displayed.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.