본문 바로가기
네트워크 수업/리눅스

[리눅스] 아파치 - 프로젝트관련(2) 23.03.31

by 6^6 2023. 3. 31.
728x90

2023.03.31 - [네트워크 수업/리눅스] - [리눅스] Apache Web Server.pdf 23.03.31

 

2023.03.30 - [네트워크 수업/리눅스] - [리눅스] 서버구축 (리눅스의 보안정책 selinux)/프로젝트관련(1) 23.03.30

2023.03.31 - [네트워크 수업/리눅스] - [리눅스] 아파치 - 프로젝트관련(2) 23.03.31

2023.04.03 - [네트워크 수업/리눅스] - [리눅스] 프로젝트관련(3) 23.04.03

 

https://onebyone1.tistory.com/247 이어서 참고..

 

 

 

[root@centos7 heejae]# rpm -qa | grep httpd   ==>rpm이 설치된 httpd를 찾아줘(Query(문의) 및 All(전부)) ==>앗 설치가 안되어있다. 
[root@centos7 heejae]# ping 168.126.63.1  ===>gns 켜주고 vmnet 2번으로 바꿔주고 핑보내기 ==>안되면 걍 bridge로 바꿔주기..(이럼 ifcfg-ens33에가서 주소들에 다 # 주석처리해야함)
64 bytes from 168.126.63.1: icmp_seq=8 ttl=57 time=33.1 ms
64 bytes from 168.126.63.1: icmp_seq=9 ttl=57 time=19.1 ms
64 bytes from 168.126.63.1: icmp_seq=10 ttl=57 time=16.1 ms
//잘간다면

ifconfig

gns ip대역으로 잘 들어갔는지 확인


[root@centos7 heejae]# yum -y install httpd*   ==> 설치 //yum : RPM 기반의 시스템을 위한 자동 업데이터 겸 패키지 설치/제거 도구 - rpm의 의존성문제 해결

Complete!

[root@centos7 html]# rpm -qa | grep httpd  ==>설치됐는지 확인
httpd-2.4.6-98.el7.centos.6.x86_64
httpd-tools-2.4.6-98.el7.centos.6.x86_64
httpd-manual-2.4.6-98.el7.centos.6.noarch
httpd-devel-2.4.6-98.el7.centos.6.x86_64

 

[root@centos7 heejae]# setenforce 0 ==>셀리눅스(리눅스 보안과 관련된 기능)를 해제한다. Enforcing(적용. 1) 되면 설치가 안된다. //setenforce: SELinux is disabled 

"SELinux 간략 정리"
enforce(1), permissive(0), disable 세 가지 모드가 있으며
RHEL/CentOS 를 설치하면 default 로 enforce mode 로 동작하며
SELinux 의 rule 에 어긋나는 operation 은 거부된다.
현재 SELinux 의 동작 모드는 "sestatus" 명령어로 확인할 수 있다.

    //만약 이 명령어 안먹히면 수동으로 넣어줘야한다. //vi /etc/sysconfig/selinux 하고 SELINUX=disabled 하고 재부팅

[root@centos7 heejae]# firewall-config  ==> 밑에처럼 둘다 바꿔주기 // 포트넘버별 서비스별로 방화벽 정책이 적용된다. // 런타임은 현재상태, 영구적은 재부팅해도 안바뀌게.

 

[root@centos7 heejae]# cd /var/www
[root@centos7 www]# ls -l
합계 0
drwxr-xr-x 2 root root 6  1월 28 02:37 cgi-bin  //755
drwxr-xr-x 2 root root 6  1월 28 02:37 html  //755

 

[root@centos7 html]# pwd  ==>확인
/var/www/html

 

[root@centos7 www]# cd html
[root@centos7 html]# vi index.html 

더보기

이거 넣고

<html>
<head>
<title>한국정보교육원</title>
</head>

<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
<p><span style="font-size:40pt;"><marquee style="left:">방가 방가 ^.^ 우리는 클라우트컴퓨팅 501호랍니다.~</marquee></span></p>
<p><img src="boa.jpg" width="851" height="229" border="0"></p>
<video oncontextmenu="return false;" id="myVideo" width="640" controls autoplay>
<source src="boa_valenti.mp4" type="video/mp4">
</video>
</body>
</html>

[root@centos7 html]# rpm -qa | grep vsftpd  ==>설치하기
vsftpd-3.0.2-29.el7_9.x86_64

[root@centos7 html]# systemctl start vsftpd

[root@centos7 html]# vi /etc/vsftpd/vsftpd.conf

12 anonymous_enable=YES.

16 local_enable=YES

19 write_enable=YES

23 local_umask=022

29 anon_upload_enable=YES

33 anon_mkdir_write_enable=YES

 

[root@centos7 html]# systemctl restart vsftpd

 

[root@centos7 html]#  cd /var/ftp/

[root@centos7 ftp]# chown ftp:ftp pub  //권한 바꿔주기
[root@centos7 ftp]# chmod 777 pub
[root@centos7 ftp]# ls -l
합계 4
drwxrwxrwx. 2 ftp  ftp    92  3월 30 17:19 pub

boa.mp4 랑 boa.jpg를 넣자

안된다면 ? 재부팅해라.

 

 

 

[root@centos7 html]#  cd /var/ftp/
[root@centos7 ftp]# cd pub
[root@centos7 pub]# ls -l
합계 13576
-rw-------  1 ftp  ftp       21662  3월 31 16:23 boa.jpg
-rw-------  1 ftp  ftp    13848936  3월 31 16:23 boa_valenti.mp4
-rw-r--r--. 1 root heejae        7  3월 30 16:39 test_ftp
-rw-r--r--. 1 root heejae        7  3월 30 16:45 test_ftp2
-rw-------. 1 ftp  ftp           0  3월 30 16:42 새 텍스트 문서.txt
-rw-------  1 ftp  ftp        6657  3월 31 16:20 이쁜이 (1).jpg
-rw-------. 1 ftp  ftp        6657  3월 30 17:19 이쁜이.jpg
[root@centos7 pub]# cp boa.jpg boa_valenti.mp4 /var/www/html/
[root@centos7 pub]# cd /var/www/
[root@centos7 www]# ls -l
합계 0
drwxr-xr-x 2 root root  6  1월 28 02:37 cgi-bin
drwxr-xr-x 2 root root 62  3월 31 16:27 html
[root@centos7 www]# cd html
[root@centos7 html]# ls -l
합계 13556
-rw------- 1 root heejae    21662  3월 31 16:27 boa.jpg
-rw------- 1 root heejae 13848936  3월 31 16:27 boa_valenti.mp4
-rw-r--r-- 1 root heejae      498  3월 31 15:59 index.html
[root@centos7 html]# chmod 755 boa.jpg
[root@centos7 html]# chmod 755 boa_valenti.mp4
[root@centos7 html]# systemctl restart httpd
[root@centos7 html]# 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 금 2023-03-31 16:28:38 KST; 8s ago
     Docs: man:httpd(8)
           man:apachectl(8)
 Main PID: 6820 (httpd)
   Status: "Processing requests..."
    Tasks: 6
   CGroup: /system.slice/httpd.service
           ├─6820 /usr/sbin/httpd -DFOREGROUND
           ├─6824 /usr/sbin/httpd -DFOREGROUND
           ├─6825 /usr/sbin/httpd -DFOREGROUND
           ├─6827 /usr/sbin/httpd -DFOREGROUND
           ├─6830 /usr/sbin/httpd -DFOREGROUND
           └─6831 /usr/sbin/httpd -DFOREGROUND

 3월 31 16:28:37 centos7 systemd[1]: Starting The Apache HTTP Server...
 3월 31 16:28:37 centos7 httpd[6820]: AH00558: httpd: Could not reliably determine the server's ful...sage
 3월 31 16:28:38 centos7 systemd[1]: Started The Apache HTTP Server.
Hint: Some lines were ellipsized, use -l to show in full.

 

 

여기까지 하고

인터넷켜서

 

아파치 구축 성공! 

728x90

댓글