기록해! 정리해!

Rinux (5) -아파치 데몬 핸들링 본문

Rinux

Rinux (5) -아파치 데몬 핸들링

zsuling 2022. 6. 7. 10:37

06/07

 

페도라에서 인터넷이 잘 안될때는 [유선연결됨]을 껐다 켜보기

 

리눅스에서 파일명이 conf로 끝나면 설정파일임 (확장자)

 

 

º 홈페이지 설정하기 (아파치데몬 핸들링)

 

 httpd.conf 데몬파일찾기

 

[root@localhost ~]# find / -name httpd.conf    --httpd* 해주면 모든 파일들을 찾을 수 있다

[root@localhost ~]# vi /etc/httpd/conf/httpd.conf   --절대경로를 찾아준다

 

:se nu 해주기

45라인 : 포트번호 (8099)

98라인 : DNS 서버 -포트번호랑 매핑

122,134라인 : DocumentRoot "/var/www/html" -홈페이지 위치 -> "/public_html"로 바꿔주기

 

[root@localhost ~]# systemctl restart httpd --서비스를 수정했으면 항상 리스타트해줘야함

 

어라 에러가 났어요

 

[root@localhost ~]# httpd -t --구문의 에러를 찾아줌

 

디렉토리가 존재하지않습니다

 

[root@localhost ~]# cd / 
[root@localhost /]# mkdir public_html --만들어주기

[root@localhost /]# ls -l

drwxr-xr-x    2 root root  4096  6월  7 09:55 public_html  --만들어진거 확인할 수 있음

 

인덱스를 만들어줄게요

 

[root@localhost /]# cd public_html --에러없는거 확인할 수 있음
[root@localhost public_html]# vi index.html

 

<h1>  systemctl restart httpd </h1>

 

[root@localhost public_html]# systemctl restart httpd --데몬 재시작

 

해서 파이어폭스에 127.0.0.1:8099/index.html 해주면

systemctl restart httpd 를 볼 수 있음

 

다시 원상복귀시켜보겠습니다


[root@localhost public_html]# vi /etc/httpd/conf/httpd.conf

 

  45 Listen 8888

  122 DocumentRoot "/var/www/html"

  134 <Directory "/var/wwww/html">

  167     DirectoryIndex index.html index.htm index.php --추가해주고 이 인덱스는 앞에서부터 순서대로 사용됨

 

[root@localhost public_html]# systemctl restart httpd
[root@localhost public_html]# cd /
[root@localhost /]# rm -rf public_html
[root@localhost /]# cd /var/www/html
[root@localhost html]# ls
img  index.html  index.php

[root@localhost html]# mv index.html main.htm --index.html 을 main.htm 으로 옮긴다

[root@localhost html]# ls
img  index.php  main.htm

index.php 화면


[root@localhost html]# mv main.htm index.htm --main.htm을 index.htm으로 옮긴다

root@localhost html]# ls
img  index.htm  index.php

index.htm 화면

 

 

'Rinux' 카테고리의 다른 글

Rinux 예제 (2)  (0) 2022.06.07
Rinux (6) - 기본 명령어  (0) 2022.06.07
Rinux (4)  (0) 2022.06.03
Rinux(예제 1)  (0) 2022.06.03
Rinux(3) -C언어 실습  (0) 2022.06.03
Comments