1、安装
yum install httpd
2、关闭防火墙或放开端口。HTTP和HTTPS对应端口80和443
vi /etc/sysconfig/iptables
然后重启防火墙
service iptables restart
3、启动httpd服务
service httpd start
4、此时应该已经可以访问http://IP验证是否成功,可以看到apache的默认欢迎页面。证明部署成功。
5、修改站点根目录
vi /etc/httpd/conf/httpd.conf
DocumentRoot "/var/www/html"修改为仓库对应的目录,我此处修改为DocumentRoot "/var/ftp/centos"
<Directory "/var/www/html">也是一样,修改为<Directory "/var/ftp/centos">
然后还要删除welcome配置,直接访问根目录
cd /etc/httpd/conf.d/
mv welcome.conf welcome.conf.bak
6、重启apache
service httpd restart