CentOS7安装apache httpd服务

发布时间:2020-07-24 20:35:20 作者:fei_0123456789
来源:网络 阅读:971

 虚拟机:192.168.2.21    
 【停止防火墙】
   sudo systemctl stop firewalld.service      --停止防火墙
   sudo systemctl disable firewalld.service   --开机关闭防火墙
   
 【安装apache httpd服务】
   cat /etc/yum.repos.d/CentOS-Media.repo   -----查看镜像配置
   yum --disablerepo=\* --enablerepo=c7-media,offline-extras,offline-storage-gluster38 list | grep httpd       --查看本地镜像是否有 apache httpd 的rpm安装包
   sudo yum --disablerepo=\* --enablerepo=c7-media,offline-extras,offline-storage-gluster38 install httpd      --安装httpd服务
   sudo systemctl list-unit-files httpd.service    --查看httpd服务
   sudo systemctl enable  httpd.service && sudo systemctl start httpd.service  --启动httpd服务
   sudo systemctl -l status  httpd.service         --查看httpd服务
   sudo netstat -tpnl            --查看httpd服务占用端口
   curl http://localost          --测试httpd是否安装成功
   curl http://127.0.0.1         --测试httpd是否安装成功
   curl http://192.168.2.21              --测试httpd是否安装成功
   sudo systemctl -l status firewalld.service      --查看防火墙状态
   sudo systemctl stop firewalld.service           --停止防火墙
   sudo systemctl disable firewalld.service        --开机关闭防火墙
   
   ls /var/www/html                                 --这是封装的http访问的入口
   sudo ln -s /home/ecp2/mirror/ /var/www/html/     --在/var/www/html下创建/home/ecp2/mirror 目录的 快捷方式 但由于权限的问题 这种操作访问不了
   sudo chown -R apache: mirror/                    --将文件mirror文件的读权限给apache用户 (这样依然没有权限访问)
   sudo cp -r /home/ecp2/mirror .                   --把/home/ecp2/mirror镜像目录复制到.当前目录 即/var/www/html (这样在浏览器http://192.168.2.21/mirror 就可以访问了)
 

推荐阅读:
  1. centos7下安装apache
  2. CentOS7 Apache 2.4.23 + php-5.6.30 安装 配置

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

apache httpd ce

上一篇:查看数据盘UUID并进行挂载

下一篇:C语言中你可能会用到的字符串函数的代码

相关阅读

您好,登录后才能下订单哦!

密码登录
登录注册
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》