ubuntu-安装Apache2
ubuntu-安装Apache2
参考: Ubuntu 18.04下使用Apache搭建一个web服务器 - https://blog.csdn.net/weixin_39212776/article/details/81192847
安装步骤
安装
1
sudo apt install apache2 -y
查看服务状态
1
service apache2 status
一些操作Apache的常用命令
1
2
3/etc/init.d/apache2 start //启动Apache服务
/etc/init.d/apache2 stop //停止Apache服务
/etc/init.d/apache2 restart //重启Apache服务
修改指向目录
改根目录
在 /etc/apache2/sites-available 中修改 000-default.conf 中的DocumentRoot /var/www/ 修改为想要的目录 . (最好把你的目录移到 /var/www 目录之下, 不然访问时报错: You don't have permission to access / on this server
)
1 | > vi /etc/apache2/sites-available/000-default.conf |
重启服务器:
1 | /etc/init.d/apache2 restart |