[네이버클라우드캠프] - 7일차 (WEB serve-php,wp )

holy one·2023년 5월 2일
0
  • mount 복습
    1. windows ===> c:/mywin
    2. linux Dir ==> /myLinux
      indows에서 c:/mywin 폴더 만든다.
      virtualBox에서 공유 폴더 설정해준다. 이름 mywind으로 지정 후 리눅스에서 마운트 한다.
root@nc7
20:01:56:/myLinux# dir /myLinux/
hello.txt


root@nc7
20:00:40:~# df -h
Filesystem      Size  Used Avail Use% Mounted on
tmpfs           198M  1.2M  197M   1% /run
/dev/sda4        12G  4.8G  6.4G  43% /
tmpfs           988M     0  988M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
/dev/sda2       974M  130M  777M  15% /boot
/dev/sda5       4.9G   88K  4.6G   1% /home
/dev/sda6       9.8G   24K  9.3G   1% /data
tmpfs           198M   12K  198M   1% /run/user/1000
tmpfs           198M   12K  198M   1% /run/user/0
mywin           238G  159G   79G  67% /myLinux
root@nc7
  • 성공적인 마운트 복습

일반 사용자 홈페이지 만들기

  cd /etc/apache2/mods-enabled/
  ln -s ../mods-available/userdir.conf
  ln -s ../mods-available/userdir.load
  systemctl  restart  apache2
  
  
  useradd  buck
  passwd buck
buck 로그인 
$mkdir   public_html
$chmod  755  ~
$vi  public_html/index.html  

     1        <meta charset='utf-8'>
     2        <body bgcolor=blue text=white> <br><br> <h1><center>
     3        <hr><hr>
     4        안녕하세요. 반가워요 <br><br>
     5        <hr><br><br>

myHome.html 페이지 만들기


root@nc7
14:44:30:/var/www/html/myHOME# ls
a.png  index.html
root@nc7
14:44:35:/var/www/html/myHOME# ls
a.png  index.html
root@nc7
14:44:57:/var/www/html/myHOME# systemctl restart apache2

root@nc7
14:46:08:/var/www/html/myHOME# nl index.html
     1        <meta charset='utf-8'>
     2        <body bgcolor=blue text=white> <br><br> <h1><center>
     3        <hr><hr>
     4        안녕하세요. 반가워요 <br><br>
     5        <hr><br><br>
     6        <img src='a.png'>

따로 html을 만들지 않아도 echo 모드로 페이지에 글자를 띄울수 있다.

apache2 분석해보기

15:00:28:/etc/apache2# vi apache2.conf	
- 아파치 서버의 전반적인 동작을 제어하는 데 사용

  1 # This is the main Apache server configuration file.  It contains the
  2 # configuration directives that give the server its instructions.
  3 # See http://httpd.apache.org/docs/2.4/ for detailed information about
  4 # the directives and /usr/share/doc/apache2/README.Debian about Debian specific
  5 # hints.
  6 #
  7 #
  8 # Summary of how the Apache 2 configuration works in Debian:
  9 # The Apache 2 web server configuration in Debian is quite different to
 10 # upstream's suggested way to configure the web server. This is because Debian's
 11 # default Apache2 installation attempts to make adding and removing modules,
 12 # virtual hosts, and extra configuration directives as flexible as possible, in
 13 # order to make automating the changes and administering the server as easy as
 14 # possible.
 15
 16 # It is split into several files forming the configuration hierarchy outlined
 17 # below, all located in the /etc/apache2/ directory:
 18 #
 19 #   /etc/apache2/		- 아파치 파일 구성도
 20 #   |-- apache2.conf
 21 #   |   `--  ports.conf
 22 #   |-- mods-enabled
 23 #   |   |-- *.load
 24 #   |   `-- *.conf
 25 #   |-- conf-enabled
 26 #   |   `-- *.conf
 27 #   `-- sites-enabled
 28 #       `-- *.conf

WITH gpt

  • /etc/apache2/mods-available : Apache 웹 서버의 모듈 파일들 중 활성화되지 않은 파일들이 위치하는 디렉토리
  1. 이 디렉토리에는 Apache 웹 서버에서 사용할 수 있는 다양한 모듈 파일들이 포함한다. 이러한 모듈 파일들은 /etc/apache2/apache2.conf 파일이나 /etc/apache2/httpd.conf 파일에서 LoadModule 지시어를 사용하여 로드될 수 있다.

  2. /etc/apache2/mods-available 디렉토리에 있는 파일들 중 필요한 모듈 파일들은 /etc/apache2/mods-enabled 디렉토리에 심볼릭 링크를 생성하여 활성화할 수 있다.

  3. 예를 들어, PHP를 사용하여 동적 웹 페이지를 생성하려면 /etc/apache2/mods-available/php7.4.conf 파일을 수정하여 PHP 모듈을 활성화하고, /etc/apache2/mods-enabled/php7.4.conf로 심볼릭 링크를 생성하여 Apache 웹 서버에서 해당 모듈을 로드하도록 설정한다.

결론) /etc/apache2/mods-available 디렉토리는 Apache 웹 서버의 모듈 파일들 중 활성화되지 않은 파일들이 위치하는 디렉토리.

  • /etc/apache2/conf-enabled : Apache 웹 서버의 구성 파일들 중 활성화된 파일들이 위치하는 디렉토리
  1. 이 디렉토리에 있는 파일들은 Apache 웹 서버가 구동될 때 함께 로드되어 구성 파일로 사용. 이 디렉토리에 있는 파일들은 Apache의 Include 지시어를 사용하여 /etc/apache2/apache2.conf 파일이나 /etc/apache2/httpd.conf 파일에서 참조되어야 한다.

  2. 일반적으로 /etc/apache2/sites-enabled 디렉토리에서 가상 호스트 구성 파일들이 작성되어 conf-enabled 디렉토리로 심볼릭 링크로 생성. 이렇게 하면 /etc/apache2/apache2.conf 파일에서 Include 지시어를 사용하여 conf-enabled 디렉토리에 있는 모든 파일들을 자동으로 로드 가능하다.

결론) /etc/apache2/conf-enabled 디렉토리는 Apache 웹 서버의 활성화된 구성 파일들이 위치하는 중요한 디렉토리

  • named.conf 파일은 BIND DNS 서버에서 사용하는 설정 파일 중 하나로, 이 파일은 DNS 서버가 실행될 때 사용되는 옵션, 캐시 크기, 리소스 레코드 파일 위치 등을 구성하는 데 사용한다.
  1. named.conf 파일은 일반적으로 /etc/named.conf 경로에 위치합니다. 이 파일은 텍스트 파일로 구성되어 있으며 다음과 같은 구문을 사용된다.

  2. options 구문: DNS 서버에 대한 기본 설정을 구성한다. 예를 들어, DNS 서버의 이름, 캐시 크기, 알림 구성 등을 구성한다.

  3. zone 구문: DNS 서버가 관리하는 각 도메인에 대한 구성을 포함한다. 각 구역은 마스터 서버, 슬레이브 서버 또는 부하 분산 구성으로 정의된다.

  4. include 구문: 다른 파일에서 구성을 가져올 수 있다. 예를 들어, 추가 구성 파일을 만들어 이름을 지정하고 named.conf 파일에서 include 구문을 사용하여 해당 파일을 가져올 수 있다.

profile
☁️ 좋아요!

0개의 댓글