腾讯云下的CentOS7 配置 Apache服务器

第一步 :安装Apache服务程序(软件包名为httpd)

* yum install httpd

第二步:配置httpd.conf文件

* vi /etc/httpd/conf/httpd.conf  //使用vi编辑器打开httpd.conf文件

* 找到DocumentRoot 并修改路径到自己的网页所在的文件夹 例如 DocumentRoot “/var/www/html/fly-offial-web”

* 找到Directory 并修改主页地址例如<Directory "/var/www/html/fly-offical-web/index.html">

第三步:开启Apache服务 

* systemctl start httpd.service 开启apache服务

* systemctl enable httpd.service apache服务设置为开机自启动

现在在浏览器输入你的服务器的公网ip就能访问你的网页了

一些常用的linux操作

* systemctl start httpd.service 启动和关闭apache服务
* systemctl stop httpd.service
* systemctl restart httpd.service 重启
* systemctl enable httpd.service 开机自启动
* systemctl disable httpd.service 开机不启动
* systemctl status httpd.service 检查httpd状态
* reboot 普通重启
* shutdown -r now/10/20:35 重启
* shutdown -h now/10/20:35 关机
* poweroff关机
* 配置 /etc/httpd/conf/httpd.conf
* q!不保存退出