Apache2

这个故事还是先从删除讲起。

remove blog zh_CN

restart

1、Remove apache

$   sudo apt-get remove apache2
$   sudo apt-get --purge remove apache2
$   sudo apt-get autoremove apache2

2、Remove config files

$   sudo find /etc -name "*apache*" |xargs  rm -rf
$   sudo rm -rf /var/www
$   sudo rm -rf /etc/libapache2-mod-jk
$   sudo rm -rf /etc/init.d/apache2
$   sudo rm -rf /etc/apache2

3、Remove relative

dpkg -l |grep apache2|awk '{print $2}'|xargs dpkg -P

Purge is required to remove all the config files - if you delete the config files but only remove the package, then this is remembered & missing config files are not reinstalled by default.

4、Reinstall apache

$   sudo apt-get install apache2

5、Usage

重启建议使用 root 重启,否则有事会重启失败。

产生的启动和停止文件是:/etc/init.d/apache2

启动:sudo apache2ctl -k start

停止:sudo apache2ctl -k stop

重新启动:sudo apache2ctl -k restart

配置文件保存在:/etc/apache2

install zh_CN

Tips

$   sudo service apache2 restart

get an error:

Job for apache2.service failed. See "systemctl status apache2.service" and "journalctl -xe" for details.

use

$   apache2ctl configtest

It will highlight the error. Correct it.

  • rewrite mode

rewrite zh_CN

$ sudo a2enmod rewrite
  • error log
/var/log/apache2/error.log