Server - Apache - 基本操作: 安装, 卸载, 启停
blog01
- 概述
- apache 基本操作
- 背景
- 当了好久的咸鱼, 尝试了解一下, 自己完全不了解的东西...
- 环境
- OS
- CentOS7.2
- OS
1. 确认
- 概述
- 确认是否自带了 apache
命令
# 你要找的是 apache, 关我 httpd 什么事 # httpd 就是 apache... > systemctl status httpd > rpm -qa | grep http httpd-manual-2.4.6-89.el7.centos.noarch httpd-2.4.6-89.el7.centos.x86_64 http-parser-2.7.1-5.el7_4.x86_64 httpd-tools-2.4.6-89.el7.centos.x86_64
- 结果
命令1
# 已经装了 httpd ● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: inactive (dead) Docs: man:httpd(8) man:apachectl(8)
命令2
# httpd 就是我们要找的 apache httpd-manual-2.4.6-89.el7.centos.noarch httpd-2.4.6-89.el7.centos.x86_64 http-parser-2.7.1-5.el7_4.x86_64 httpd-tools-2.4.6-89.el7.centos.x86_64
2. 卸载
- 概述
- 卸载 现有的版本
命令
> yum remove httpd
结果
# 卸载完毕 Removed: httpd.x86_64 0:2.4.6-89.el7.centos Dependency Removed: httpd-manual.noarch 0:2.4.6-89.el7.centos mod_fcgid.x86_64 0:2.3.9-4.el7_4.1 mod_ssl.x86_64 1:2.4.6-89.el7.centos
3. 重新安装
- 概述
- 装个新的
命令
> yum search httpd > yum install httpd
4. 再次验证
- 概述
- 验证之前的安装
命令
> rpm -qa| grep httpd > systemctl status httpd
- 结果
命令1
httpd-tools-2.4.6-90.el7.centos.x86_64 httpd-2.4.6-90.el7.centos.x86_64
命令2
● httpd.service - The Apache HTTP Server Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled) Active: inactive (dead) Docs: man:httpd(8) man:apachectl(8)
- 区别
- 版本
- 2.4.6-89 > 2.4.6-90
- 包
- 少了两个包
- 版本
5. 启动与停止
- 概述
- 使用 systemctl 来启停
命令
# 启动 > systemctl start httpd # 停止 > systemctl stop httpd
- 遇到了些问题
启动失败
Jan 13 01:34:49 localhost.localdomain systemd[1]: Starting The Apache HTTP Server... Jan 13 01:34:49 localhost.localdomain httpd[2104]: AH00558: httpd: Could not reliably determine the server's fully qualifi...ssage Jan 13 01:34:49 localhost.localdomain httpd[2104]: httpd (pid 1966) already running Jan 13 01:34:49 localhost.localdomain kill[2106]: kill: cannot find process "" Jan 13 01:34:49 localhost.localdomain systemd[1]: httpd.service: control process exited, code=exited status=1 Jan 13 01:34:49 localhost.localdomain systemd[1]: Failed to start The Apache HTTP Server. Jan 13 01:34:49 localhost.localdomain systemd[1]: Unit httpd.service entered failed state. Jan 13 01:34:49 localhost.localdomain systemd[1]: httpd.service failed.
查询进程
# 卧槽, 这都是啥 # 不知道咋来的 # 杀掉了 1966, 还是不行 > ps -ef | grep httpd apache 1966 1 0 01:29 ? 00:00:00 /usr/sbin/httpd --help apache 1967 1 0 01:29 ? 00:00:00 /usr/sbin/httpd --help apache 1968 1 0 01:29 ? 00:00:00 /usr/sbin/httpd --help apache 1969 1 0 01:29 ? 00:00:00 /usr/sbin/httpd --help apache 1970 1 0 01:29 ? 00:00:00 /usr/sbin/httpd --help apache 1971 1 0 01:29 ? 00:00:00 /usr/sbin/httpd --help root 2139 1208 0 01:36 pts/1 00:00:00 grep --color=auto httpd
- 最后
- 重启了
- 重启没有这些 乱七八糟的 httpd 了
- 尝试启动
- 成功
- 重启了
ps
- 后续
- apache
- apache 有一个自带的 apachectl, 也可以做到 启停
- systemctl
- 这玩意虽然经常在用, 但还是有点不知道在说啥
- 测试使用
- 简单的 http 使用
- 可能还得了解一些 协议
- curl
- 目前暂时不关注 css, js, 所以不需要浏览器, 就能做一些测试
- 这玩意得稍微复习一下了
- C
- apache 是 C 语言写的, 但愿我有朝一日, 能够稍微理解一下这门语言
- apache
相关推荐
Kafka 2020-09-18
Wepe0 2020-10-30
杜倩 2020-10-29
windle 2020-10-29
minerd 2020-10-28
mengzuchao 2020-10-22
Junzizhiai 2020-10-10
bxqybxqy 2020-09-30
风之沙城 2020-09-24
kingszelda 2020-09-22
大唐帝国前营 2020-08-18
yixu0 2020-08-17
TangCuYu 2020-08-15
xiaoboliu00 2020-08-15
songshijiazuaa 2020-08-15
xclxcl 2020-08-03
zmzmmf 2020-08-03
newfarhui 2020-08-03
likesyour 2020-08-01