基于CentOS 7
- 远程登录 ssh ip 如果不是默认22端口,请用 ssh ip -p port
- yum安装: yum -y install httpd
- 检查是否已经成功安装了 rpm -qa httpd
- 设置web服务自动启动 systemctl enable httpd.service
- 修改配置文件:
cd /etc/httpd/conf cp httpd.conf httpd.conf.bak vim httpd.conf
备份文件:cp httpd.conf httpd.conf.bak
修改 httpd.conf文件 vim httpd.conf 绑定ip地址:Listen xx.xx.xxx.xxx:80 6. 默认根目录地址:/var/www/html 7. 创建测试页面cd /var/www/html echo "hello apache!" > index.html浏览器地址栏输入地址:http://xx.xx.xxx.xxx/index.html 即可看到 hello apache!