参考资料

  1. apache安装与配置出了yum
  2. apache安装与配置
  3. apache安装与配置 qgis
  4. apache安装与配置端口占用
  5. apache的安装
  6. apache安装与配置idea
  7. apache官网下载
  8. apache安装与配置windows
  1. 安装Apache

    • Ubuntu/Debian: sudo apt-get install apache2

    • CentOS/RHEL: sudo yum install httpd

  2. 启动Apache服务

    • Ubuntu/Debian: sudo systemctl start apache2

    • CentOS/RHEL: sudo systemctl start httpd

  3. 设置开机自启动

    • Ubuntu/Debian: sudo systemctl enable apache2

    • CentOS/RHEL: sudo systemctl enable httpd

  4. 配置防火墙

    • Ubuntu/Debian: sudo ufw allow 'Apache Full'

    • CentOS/RHEL: sudo firewall-cmd --permanent --add-service=http && sudo firewall-cmd --reload

  5. 验证安装

    • 打开浏览器,访问 http://your_server_ip,看到Apache默认页面即安装成功。

  6. 配置文件路径

    • 主配置文件: /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)

  7. 重启Apache服务

    • Ubuntu/Debian: sudo systemctl restart apache2

    • CentOS/RHEL: sudo systemctl restart httpd

  8. 检查配置语法

    • Ubuntu/Debian: sudo apachectl configtest

    • CentOS/RHEL: sudo httpd -t

声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。