Server setting 2

방화벽설정 / document root 지정/ 설정

Posted by ETHAN KIM on July 11, 2022 · 2 mins read
Server PHP

root 계정 혹은 sudo 권한 계정으로 진행


1. 방화벽 삭제 및 재설치

  • 설치상태 확인
    [root@centos7 ~]# yum list installed firewalld
    
  • 방화벽 삭제 및 재설치
    [root@centos7 ~]# yum remove firewalld.noarch
    [root@centos7 ~]# yum install firewalld
    

  • 방화벽 시작 및 상태확인
    [root@centos7 ~]# systemctl start firewalld
    [root@centos7 ~]# firewall-cmd --state
    



2. 방화벽 세팅

  • 서비스 허용
    [root@centos7 ~]# firewall-cmd --add-service=dns --zone=public --permanent
    [root@centos7 ~]# firewall-cmd --add-service=http --zone=public --permanent
    [root@centos7 ~]# firewall-cmd --add-service=https --zone=public --permanent
    [root@centos7 ~]# firewall-cmd --add-service=imaps --zone=public --permanent
    [root@centos7 ~]# firewall-cmd --add-service=smtps --zone=public --permanent
    [root@centos7 ~]# firewall-cmd --add-service=smtp --zone=public --permanent
    [root@centos7 ~]# firewall-cmd --add-service=samba --zone=public --permanent
    [root@centos7 ~]# firewall-cmd --permanent --zone=public --add-service=ftp
    
  • 포트 허용
    [root@centos7 ~]# firewall-cmd --permanent --zone=public --add-port=80/tcp
    [root@centos7 ~]# firewall-cmd --zone=public --permanent --add-port=22/tcp
    [root@centos7 ~]# firewall-cmd --zone=public --permanent --add-port=21/tcp
    
  • 재시작
    [root@centos7 ~]# firewall-cmd --reload
    



3. FTP 설정

  • vsftpd 설치
    [root@centos7 ~]# yum -y install vsftpd
    
  • ftp 허용 유저 리스트 수정
    [root@centos7 ~]# vi /etc/vsftpd/chroot_list
    ---vim---
    root
    mem1
    mem2
    
  • vsftpd 재시작
    [root@centos7 ~]# systemctl restart vsftpd
    



3. apache 홈디렉터리

  • document root 설정
    [root@centos7 ~]# vi /etc/httpd/conf/httpd.conf
    ---vim---
    ...
    DocumentRoot "/var/www/html"    원하는 경로로 변경
    ...