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.