部署测试环境

2023-06-06  本文已影响0人  E术家

下载并安装Apache服务

[root@localhost ~]# yum install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
 * base: mirrors.bfsu.edu.cn
 * extras: mirrors.ustc.edu.cn
 * updates: mirrors.ustc.edu.cn
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-99.el7.centos.1 will be installed
--> Processing Dependency: httpd-tools = 2.4.6-99.el7.centos.1 for package: httpd-2.4.6-99.el7.centos.1.x86_64
--> Processing Dependency: /etc/mime.types for package: httpd-2.4.6-99.el7.centos.1.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-99.el7.centos.1 will be installed
---> Package mailcap.noarch 0:2.1.41-2.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

=======================================================================================================
 Package                Arch              Version                             Repository          Size
=======================================================================================================
Installing:
 httpd                  x86_64            2.4.6-99.el7.centos.1               updates            2.7 M
Installing for dependencies:
 httpd-tools            x86_64            2.4.6-99.el7.centos.1               updates             94 k
 mailcap                noarch            2.1.41-2.el7                        base                31 k

Transaction Summary
=======================================================================================================
Install  1 Package (+2 Dependent packages)

Total download size: 2.8 M
Installed size: 9.6 M
Is this ok [y/d/N]: y
Downloading packages:
(1/3): httpd-tools-2.4.6-99.el7.centos.1.x86_64.rpm                             |  94 kB  00:00:00     
(2/3): httpd-2.4.6-99.el7.centos.1.x86_64.rpm                                   | 2.7 MB  00:00:01     
(3/3): mailcap-2.1.41-2.el7.noarch.rpm                                          |  31 kB  00:00:01     
-------------------------------------------------------------------------------------------------------
Total                                                                  2.0 MB/s | 2.8 MB  00:00:01     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : httpd-tools-2.4.6-99.el7.centos.1.x86_64                                            1/3 
  Installing : mailcap-2.1.41-2.el7.noarch                                                         2/3 
  Installing : httpd-2.4.6-99.el7.centos.1.x86_64                                                  3/3 
  Verifying  : httpd-2.4.6-99.el7.centos.1.x86_64                                                  1/3 
  Verifying  : mailcap-2.1.41-2.el7.noarch                                                         2/3 
  Verifying  : httpd-tools-2.4.6-99.el7.centos.1.x86_64                                            3/3 

Installed:
  httpd.x86_64 0:2.4.6-99.el7.centos.1                                                                 

Dependency Installed:
  httpd-tools.x86_64 0:2.4.6-99.el7.centos.1               mailcap.noarch 0:2.1.41-2.el7              

Complete!

yum install httpd

关闭防火墙

[root@localhost ~]# systemctl stop firewalld.service 

systemctl stop firewalld.service

关闭内置的安全增强模式

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

setenforce 0

启动Apache服务

[root@localhost ~]# systemctl start httpd

systemctl start httpd

查看Apache服务状态

[root@localhost ~]# systemctl status httpd
● httpd.service - The Apache HTTP Server
   Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
   Active: active (running) since Wed 2023-06-07 17:16:45 CST; 44s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 55229 (httpd)
   Status: "Total requests: 10; Current requests/sec: 0; Current traffic:   0 B/sec"
   CGroup: /system.slice/httpd.service
           ├─55229 /usr/sbin/httpd -DFOREGROUND
           ├─55230 /usr/sbin/httpd -DFOREGROUND
           ├─55231 /usr/sbin/httpd -DFOREGROUND
           ├─55232 /usr/sbin/httpd -DFOREGROUND
           ├─55233 /usr/sbin/httpd -DFOREGROUND
           ├─55234 /usr/sbin/httpd -DFOREGROUND
           ├─55235 /usr/sbin/httpd -DFOREGROUND
           ├─55236 /usr/sbin/httpd -DFOREGROUND
           └─55237 /usr/sbin/httpd -DFOREGROUND

Jun 07 17:16:45 localhost.localdomain systemd[1]: Starting The Apache HTTP Server...
Jun 07 17:16:45 localhost.localdomain httpd[55229]: AH00558: httpd: Could not reliably determine ...age
Jun 07 17:16:45 localhost.localdomain systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.

`[root@localhost ~]# systemctl status httpd

将html页面放至Apache目录

路径:/var/www/html

打开页面

上一篇 下一篇

猜你喜欢

热点阅读