Linux下Apache安装_学习记录
Centos 7 版本
一、Yum安装Apache的实验步骤:
1. Yum install httpd
2. 编辑/etc/httpd/conf/httpd.conf文件,编辑内容如下:
删除#ServerName www.example.com:80改行前“#”,使用wq,保存退出。
3. 启动httpd服务, 执行systemctl start httpd.
执行netstat –na | grep 80, 查看80端口是否启动
4. 使用本机浏览器访问http://IP(在此之前,应关闭firewalld)
二、编译安装Apache
1. wget http://mirrors.shu.edu.cn/apache//httpd/httpd-2.4.37.tar.gz
2. 解压httpd-2.4.37.tar.gz
运行: tar zxvf httpd-2.4.37.tar.gz
3. 执行 ./configure –prefix=/usr/local/apache2
Make
Make install
Yum install apr*
Yum install gcc libc6-dev后:
Yum install pcre*后 ./configure –prefix=/usr/local/apache2--comlete!
4. 执行 ./configure –prefix=/usr/local/apache2
Make && Make install
完成安装。
5. 修改httpd.conf配置文件。
6. 启动httpd的命令如下:
/usr/local/apache2/bin/apachectl start