1、安装apache

yum install httpd #根据提示,输入Y安装即可成功安装

systemctl start httpd.service #启动apache

systemctl stop httpd.service #停止apache

systemctl restart httpd.service #重启apache

systemctl enable httpd.service #设置apache开机启动

2、启动http服务

httpd -version #检查是否安装

yum install httpd #安装http服务

service httpd start #启动http服务

service httpd status #检查http服务状态(会显示绿色的active(running)表示启动成功)

service httpd restart #重启http服务

3、配置文件

httpd相关配置文件:

主配置文件:/etc/httpd/conf/httd.conf ,这个是httpd最主要的配置文档

扩展配置文件:/etc/httpd/conf.d/*.conf ,这个是httpd的额外配置文档

文档根目录: /var/www/html ,这个是apache 首页的文档目录 ,即输入http://127.0.0.1  显示页面所在的目录

服务脚本:/etc/rc.d/init.d/httpd

错误目录:/var/www/error  ,服务器设定错误,请求的资源错误或浏览器访问出现错误等错误文件的存储目录

CGI目录: /var/www/cgi-bin/   ,预设为CGI运行脚本的存储目录

日志目录:/var/log/httpd  ,client端登录httpd时,记录的登录日志等信息存储目录

脚本配置文件: /etc/sysconfig/httpd

Listen端口:80/tcp  ,443/tcp

命令执行文件:/usr/sbin/apachectl ,/usr/sbin/httpd,/usr/bin/htpasswd

PID文件:/var/run/httpd/httpd.pid

4、开放80端口 打开防火墙

查看指定区域所有开启的端口号

firewall-cmd --zone=public --list-ports

在指定区域开启端口(如80端口号,命令方式)

firewall-cmd --zone=public --add-port=80/tcp --permanent

重新启动防火墙

firewall-cmd --reload

参考网址:https://blog.csdn.net/u014079773/article/details/79745819

5、测试网页

echo “This is my first web page.”>/var/www/html/index.html

打开http://127.0.0.1 查看是否正常启动

Linux:启动http服务的更多相关文章

  1. 如何查看和停止Linux启动的服务

    1. 查看Linux启动的服务chkconfig --list 查询出所有当前运行的服务chkconfig --list atd  查询atd服务的当前状态 2.停止所有服务并且在下次系统启动时不再启 ...

  2. Linux启动ssh服务

    Linux启动ssh服务 在Linux下启动ssh服务使用如下命令其一即可: # service sshd start # /etc/init.d/sshd start 开机启动 使用如下方法其就可以 ...

  3. linux启动httpd服务出现 Could not reliably determine the server`s fully qualified domain name.

    安装好apache启动httpd服务时,出现httpd: Could not reliably determine the server's fully qualified domain name,  ...

  4. linux启动http服务

    1.安装apache yum install httpd #根据提示,输入Y安装即可成功安装 systemctl start httpd.service #启动apache systemctl sto ...

  5. Linux 启动SVN服务

    #使用默认端口3690启动svn服务svnserve -d -r /home/svndata # 如果出现#svnserve: Can't bind server socket: Address al ...

  6. linux 启动ftp服务,sftp服务

    启动ftp服务:yum install vsftpd 在/etc/rc.d/init.d/目录下:命令 service vsftp start启动ssh服务,sftp服务在/etc/init.d/目录 ...

  7. Linux启动一个服务后,服务的某个文件所在的目录下出现类似:systemd-private.xxxxxx的目录

    Linux的目录下面形如: [root@:vg_adn_tidbCkhsTest:172.31.17.203 /var/lib/mysql]#ll /tmp total drwxr root root ...

  8. linux启动oracle服务 和监听

    (1) su - oracle 切换成oracle 用户 (2)sqlplus / as sysdba (3)startup: (4)quit:退出sql模式 exit 退出oracle用户 (5)l ...

  9. 【转】Linux学习之路--启动VNC服务

    我的Linux是Fedora 13,安装方法如下: 1.打开终端,执行 # yum install -y tigervnc tigervnc-server 2.编辑/etc/sysconfi/vncs ...

  10. linux下tomcat服务的启动、关闭与错误跟踪

    linux下tomcat服务的启动.关闭与错误跟踪,远程连接到服务器以后,通常通过以下几种方式启动关闭tomcat服务: 1).启动tomcat服务 进入tomcat主目录下的bin目录,然后执行如下 ...

随机推荐

  1. java.lang.reflect.UndeclaredThrowableException: null Caused by: org.apache.zookeeper.KeeperException$UnimplementedException: KeeperErrorCode = Unimplemented for

    java.lang.reflect.UndeclaredThrowableException: null    at org.springframework.util.ReflectionUtils. ...

  2. C# .Net Core 3.1 中关于Process.Start 启动Url链接的问题

    WPF 项目迁移到.Net Core中时居然出了一堆问题...(很无语) 今天在使用的时候居然发现Process.Start居然打不开Url链接了? 报 找不到指定文件 的异常?! 一.bug重现 首 ...

  3. R时间序列分析实例

    一.作业要求 自选时间序列完成时间序列的建模过程,要求序列的长度>=100. 报告要求以下几部分内容: 数据的描述:数据来源.期间.数据的定义.数据长度. 作时间序列图并进行简单评价. 进行时间 ...

  4. php里面的一些面试经典的函数

    <?php /* 这是一个多线程的读取解决的函数 @param1 $fle 传入要读取的文件名 */ function filelock($fle){ $fp=fopen($fls,'w+'); ...

  5. 【Python】2.12学习笔记 变量

    变量 关于变量我有一个不能理解的,关于全局变量作用域与地址的问题,学函数的时候我可能会搞懂它并且写下来 另外,其实昨天说的是有些不准确的,\(Python\)里的变量不是不用声明类型,只是声明方式特殊 ...

  6. 曹工说Spring Boot源码(23)-- ASM又立功了,Spring原来是这么递归获取注解的元注解的

    写在前面的话 相关背景及资源: 曹工说Spring Boot源码(1)-- Bean Definition到底是什么,附spring思维导图分享 曹工说Spring Boot源码(2)-- Bean ...

  7. 公钥体系(PKI)等密码学技术基础

    公钥体系(PKI)等密码学技术基础 公钥体系(Public Key Infrastructure, PKI)的一些概念 对称密码算法, 典型算法:DES, AES 加解密方共用一个密钥 加/解密速度快 ...

  8. Vulnhub靶场 DC-2 WP

    DC-2简介 描述 与DC-1一样,DC-2是另一个专门构建的易受攻击的实验室,目的是获得渗透测试领域的经验. 与原始DC-1一样,它在设计时就考虑了初学者. 必须具备Linux技能并熟悉Linux命 ...

  9. MyBatis框架——单表查询

    Mybatis单表查询,示例 1.创建数据库 /* Navicat MySQL Data Transfer Source Server : localhost Source Server Versio ...

  10. ComplexBrowser: a tool for identification and quantification of protein complexes in large-scale proteomics datasets(大规模蛋白组学数据集中鉴定和定量蛋白复合物)

    文献名:ComplexBrowser: a tool for identification and quantification of protein complexes in large-scale ...