Deepin 25 安装与配置 Apache2

1,打开终端

2,更新包管理器的软件列表

sudo apt update

 3,安装 Apache 2.4

sudo apt install apache2

4,提示是否继续安装,输入 Y 继续安装

 5,确认 Apache 是否正确安装

apache2 -v

这个命令会显示安装的 Apache 版本

 6,启动 Apache 服务

sudo systemctl start apache2

7,设置 Apache 服务开机自启

sudo systemctl enable apache2

8,检查 Apache 服务状态

sudo systemctl status apache2

 9,访问 Apache 默认页面

http://localhost 
http://127.0.0.1

10,出现Apache 的默认页面,表示服务正常

 

 

 

PS:如果需要使用非默认目录(如/srv),需在/etc/apache2/apache2.conf中添加白名单:

<Directory "/srv">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

 然后重启Apache服务

sudo systemctl restart apache2

 

posted @ 2025-06-19 16:37  fengdong  阅读(62)  评论(0)    收藏  举报