1. 아파치 웹서버 설치하기
    1. sudo apt-get update
    2. sudo apt-get upgrade
    3. sudo apt-get install apache2
    4. sudo /etc/init.d/apache2 restart
    5. sudo ufw allow 80
  2. /etc/apache2/apache2.conf 설정하기
    1. Timeout
    2. KeepAlive
    3. MaxKeepAliveRequests
    4. KeepAliveTimeout
    5. ErrorLog
    6. Logevel
    7. LogFormat
    8. IncludeOptional, Include
    9. <Directory> ~ </Directory>
    10. AccessFileName
  3. /etc/apache2/ports.conf 설정하기
    1. Listen
  4. /etc/apache2/sites-enabled/000-default.conf 설정하기
    1. DocumentRoot /var/www/html
  5. /etc/apache2/mods-enabled/dir.conf 설정하기
    1. DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
  6. 사용자 웹 사이트 운영
    1. userdir 모듈을 활성화
      1. sudo  a2enmod  userdir
      2. sudo  /etc/init.d/apache2 restart
    2. userdir 모듈 해지
      1. sudo a2dismod userdir
      2. sudo  /etc/init.d/apache2 restart
  7. 아파치 설치 완료 여부 알아보기
    1. apache2 -v : 설치된 아파치 버전 보기
    2. dpkg -l apache2 : 설치된 아파치 상태 알아보기
    3. apt-cache policy apache2 : 설치된 아파치 정책 보기
  8. 아파치 실행 관련 명령
    1. sudo service apache2 stop
    2. sudo service apache2 start
    3. sudo service apache2 status
    4. sudo service apache2 restart
    5. sudo service apache2 reload
    6. sudo systemctl stop apache2
    7. sudo systemctl start apache2
    8. sudo systemctl status apache2
    9. sudo systemctl restart apache2
    10. sudo systemctl reload apache2
    11. sudo /etc/init.d/apache2 stop
    12. sudo /etc/init.d/apache2 start
    13. sudo /etc/init.d/apache2 status
    14. sudo /etc/init.d/apache2 restart
    15. sudo /etc/init.d/apache2 reload
  9. 참조 : https://jimnong.tistory.com/733?category=575588
  10. 사용자 계정 활성화
    1. sudo vi /etc/apache2/mods-available/userdir.conf
    2. sudo vi /etc/apache2/mods-available/phpX.X.conf

      1. 3행을 On으로 수정
    3. sudo a2enmode userdir
      1. ~사용자/public_html에 홈페이지 생성가능
    4. sudo /etc/init.d/apache2 restart
      1. sudo service apache2 force-reload
  11. 아파치 가상 호스트 추가
    1. DocumentRoot 폴더 생성과 설정
      1. sudo mkdir /var/www/newsite
      2. sudo chown -R www-data:www-data /var/www/newsite
      3. sudo vi /var/www/newsite/index.html
    2. hosts 파일 편집
      1. sudo vi /etc/hosts
    3. 설정파일 편집
      1. cd /etc/apache2/sites-available
      2. sudo cp 000-default.conf newsite.conf
      3. sudo vi newsite.conf
      4. sudo a2ensite newsite
    4. 아파치 재실행
      1. sudo service apache2 restart
    5. VirtualBox의 Firefox에서 http://www.newsite.net 접속
error: Content is protected !!