리눅스] 웹서버(httpd) 설치하기

2018.04.23 07:00



리눅스(centos)에서 웹서버(httpd) 설치 시작하기



cetnos 에서 간단하게 웹서비스 시작하기 



테스트용으로 웹서비스를 돌려보려고한다. 


 


httpd 설치



# yum -y install httpd



1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
[root@centos6 /etc]yum -y install httpd
Loaded plugins: fastestmirror, refresh-packagekit, security
Setting up Install Process
Loading mirror speeds from cached hostfile
 * base: centos.mirror.moack.net
 * extras: ftp.tsukuba.wide.ad.jp
 * updates: ftp.tsukuba.wide.ad.jp
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.2.15-39.el6.centos will be updated
---> Package httpd.x86_64 0:2.2.15-60.el6.centos.6 will be an update
--> Processing Dependency: httpd-tools = 2.2.15-60.el6.centos.6 for package: httpd-2.2.15-60.el6.centos.6.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.2.15-39.el6.centos will be updated
---> Package httpd-tools.x86_64 0:2.2.15-60.el6.centos.6 will be an update
--> Finished Dependency Resolution
 
Dependencies Resolved
 
================================================================================
 Package          Arch        Version                        Repository    Size
================================================================================
Updating:
 httpd            x86_64      2.2.15-60.el6.centos.6         updates      836 k
Updating for dependencies:
 httpd-tools      x86_64      2.2.15-60.el6.centos.6         updates       80 k
 
Transaction Summary
================================================================================
Upgrade       2 Package(s)
 
Total download size: 916 k
Downloading Packages:
(1/2): httpd-2.2.15-60.el6.centos.6.x86_64.rpm           | 836 kB     00:01     
(2/2): httpd-tools-2.2.15-60.el6.centos.6.x86_64.rpm     |  80 kB     00:00     
--------------------------------------------------------------------------------
Total                                           407 kB/| 916 kB     00:02     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Updating   : httpd-tools-2.2.15-60.el6.centos.6.x86_64                    1/4 
  Updating   : httpd-2.2.15-60.el6.centos.6.x86_64                          2/4 
  Cleanup    : httpd-2.2.15-39.el6.centos.x86_64                            3/4 
  Cleanup    : httpd-tools-2.2.15-39.el6.centos.x86_64                      4/4 
  Verifying  : httpd-2.2.15-60.el6.centos.6.x86_64                          1/4 
  Verifying  : httpd-tools-2.2.15-60.el6.centos.6.x86_64                    2/4 
  Verifying  : httpd-2.2.15-39.el6.centos.x86_64                            3/4 
  Verifying  : httpd-tools-2.2.15-39.el6.centos.x86_64                      4/4 
 
Updated:
  httpd.x86_64 0:2.2.15-60.el6.centos.6                                         
 
Dependency Updated:
  httpd-tools.x86_64 0:2.2.15-60.el6.centos.6                                   
 
Complete!
 
cs





웹페이지 설정


httpd 설치후 웹페이지 설정은 기본값 그대로이다.


index.html을 적당히 편집한다.



# vi /var/www/html/index.html



1
2
3
4
5
[root@centos6 ~]# cat /var/www/html/index.html
 
 
<h1> 웹서버 테스트
      - ttend.tistory.com </h1>
cs





웹서비스 시작


# service httpd start



1
2
3
4
[root@centos6 ~]service httpd start
httpd (을)를 시작 중: httpd: apr_sockaddr_info_get() failed for centos6
httpd: Could not reliably determine the server s fully qualified domain name, using 127.0.0.1 for ServerName
         

cs





웹페이지 테스트




웹서비스가 올라간 웹서버는 가상머신이다. 

웹브라우저에서 localhost를 입력하면 웹서비스가 정상적으로 서비스된다.




호스트 PC에서 가상머신의 IP 주소(192.168.100.180)을 입력해도 같은 결과이다. 




또루아빠 Linux, Unix , , , , , ,