安装Apache服务器 /linux

 安装Apache前需要配置的内容在上一篇文章

安装Apache相关软件

[root@centos ~]#  rpm -q httpd
[root@centos ~]# mkdir /iso
[root@centos ~]# mount /dev/cdrom /iso
[root@centos ~]# yum clean all 
[root@centos ~]#  yum install httpd -y
[root@centos ~]#  yum install firefox -y
[root@centos ~]# rpm -qa|grep httpd



启动或重新启动、停止Apache服务

[root@centos ~]# systemctl start/restart/stop  httpd

使用防火墙命令,放行http服务

[root@centos ~]# firewall-cmd --list-all
[root@centos ~]# firewall-cmd --permanent --add-service=http
success
[root@centos ~]# firewall-cmd --reload
success
[root@centos ~]# firewall-cmd --list-all

更改当前的SELinux值

	
[root@centos ~]# setenforce 0
[root@centos ~]# getenforce
Permissive

 测试httpd服务是否安装成功  网址跳转后可关闭

[root@centos ~]# systemctl start httpd
[root@centos ~]# systemctl enable httpd
Created symlink from /etc/systemd/system/multi-user.target.wants/httpd.service to /usr/lib/systemd/system/httpd.service.
[root@centos ~]# firefox http://127.0.0.1

 当前网站普遍的首页面名称是index.html   因此可以向/var/www/html目录中写入一个文件 会立即生效:

[root@centos ~]# echo "Welcome To MyWeb" > /var/www/html/index.html
[root@centos ~]# firefox http://127.0.0.1

本机可直接跳转 网络卡可直接打开火狐浏览器搜索网址

客户端直接打开浏览器搜索www.long60.cn

  • 9
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值