admin管理员组文章数量:1034744
apache安装与配置 linux
- 安装Apache
- Ubuntu/Debian: sudo apt-get install apache2
- CentOS/RHEL: sudo yum install httpd
- 启动Apache服务
- Ubuntu/Debian: sudo systemctl start apache2
- CentOS/RHEL: sudo systemctl start httpd
- 设置开机自启动
- Ubuntu/Debian: sudo systemctl enable apache2
- CentOS/RHEL: sudo systemctl enable httpd
- 配置防火墙
- Ubuntu/Debian:
sudo ufw allow 'Apache Full'
- CentOS/RHEL:
sudo firewall-cmd --permanent --add-service=http && sudo firewall-cmd --reload
- Ubuntu/Debian:
- 验证安装
- 打开浏览器,访问
http://your_server_ip
,看到Apache默认页面即安装成功。
- 打开浏览器,访问
- 配置文件路径
- 主配置文件:
/etc/apache2/apache2.conf
(Ubuntu/Debian) 或/etc/httpd/conf/httpd.conf
(CentOS/RHEL) - 站点配置文件:
/etc/apache2/sites-available/
(Ubuntu/Debian) 或/etc/httpd/conf.d/
(CentOS/RHEL)
- 主配置文件:
- 重启Apache服务
- Ubuntu/Debian:
sudo systemctl restart apache2
- CentOS/RHEL:
sudo systemctl restart httpd
- Ubuntu/Debian:
- 检查配置语法
- Ubuntu/Debian:
sudo apachectl configtest
- CentOS/RHEL:
sudo httpd -t
- Ubuntu/Debian:
apache安装与配置 linux
- 安装Apache
- Ubuntu/Debian: sudo apt-get install apache2
- CentOS/RHEL: sudo yum install httpd
- 启动Apache服务
- Ubuntu/Debian: sudo systemctl start apache2
- CentOS/RHEL: sudo systemctl start httpd
- 设置开机自启动
- Ubuntu/Debian: sudo systemctl enable apache2
- CentOS/RHEL: sudo systemctl enable httpd
- 配置防火墙
- Ubuntu/Debian:
sudo ufw allow 'Apache Full'
- CentOS/RHEL:
sudo firewall-cmd --permanent --add-service=http && sudo firewall-cmd --reload
- Ubuntu/Debian:
- 验证安装
- 打开浏览器,访问
http://your_server_ip
,看到Apache默认页面即安装成功。
- 打开浏览器,访问
- 配置文件路径
- 主配置文件:
/etc/apache2/apache2.conf
(Ubuntu/Debian) 或/etc/httpd/conf/httpd.conf
(CentOS/RHEL) - 站点配置文件:
/etc/apache2/sites-available/
(Ubuntu/Debian) 或/etc/httpd/conf.d/
(CentOS/RHEL)
- 主配置文件:
- 重启Apache服务
- Ubuntu/Debian:
sudo systemctl restart apache2
- CentOS/RHEL:
sudo systemctl restart httpd
- Ubuntu/Debian:
- 检查配置语法
- Ubuntu/Debian:
sudo apachectl configtest
- CentOS/RHEL:
sudo httpd -t
- Ubuntu/Debian:
本文标签: apache安装与配置 linux
版权声明:本文标题:apache安装与配置 linux 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/jiaocheng/1748164412a2262798.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论