【linux】Ubuntu16.04安装 apache2

版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/qq_40307434/article/details/84332984

遇到了各种各样的奇怪问题。
输入localhost说什么没有权限,然后把apache2.conf中denid改成enable不断404notfound。
按照各种教程进行了各种配置但是还老找不到配置文件,因为网上那些目录我可能打开就没有任何文件。
想着这遍还不成功就虚拟机重装系统了,结果迷迷糊糊成功了,嘻嘻。

1.安装apache2
$ sudo apt-get update
$ sudo apt-get install apache2
$ sudo apt-get install apache2-dev
(完全卸载apache2:
$ sudo apt-get --purge remove apache2
$ sudo apt-get --purge remove apache2.2-common
$ sudo apt-get autoremove //找到没有删干净的配置文件,删除
$ sudo find /etc -name “apache” -exec rm -rf {};
$ sudo rm -rf /var/www )

2.查看安装是否成功
sudo systemctl status apache2
在这里插入图片描述
在浏览器输入localhost或者127.0.0.1或者本机ip(ifconfig中inet addr)
在这里插入图片描述
3.查看安装位置
Whereis apache2
4.查看apache版本apache2ctl -v
5.正常启动关闭apache,查看对应的systemctl status发现状态有所不同。
$ sudo /etc/init.d/apache2 stop//停止后localhost unable to connect啦
$ sudo /etc/init.d/apache2 restart//重启
$ sudo /etc/init.d/apache2 start//启动

参考教程:
https://blog.csdn.net/sunshineddmmz/article/details/79628366
https://www.cnblogs.com/yaosj/p/7008047.html

猜你喜欢

转载自blog.csdn.net/qq_40307434/article/details/84332984