본문 바로가기

카테고리 없음

centos 7.6 apache2.4 php7.3 설치

Linux apache php 설치 OS: centos 7.6 web server: Apache 2.4.6 php 7.3 1. apache설치
yum install httpd
systemctl start httpd
systemctl status httpd
systemctl enable httpd.service
1-1 apache info, status 활성화 및 접속 정책 할당
vi /etc/httpd/conf.d/status_info.conf

    SetHandler server-status
    Order deny,allow
    Deny from all
    Allow from [접속IP]




    SetHandler server-info
    Order deny,allow
    Deny from all
    Allow from [접속IP]


2. php 설치 2-1 php 7.3 설치 repogitory 등록
rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm

rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

yum -y install yum-utils

yum repolist

yum-config-manager --disable remi-php54
yum-config-manager --enable remi-php73

2-2 php7.3 설치
yum install php \
php-devel \
php-common \
php-cli \
php-redis \
php-brotli \
php-gd \
php-gmp \
php-imap \
php-bcmath \
php-interbase \
php-json \
php-mbstring \
php-mysqlnd \
php-odbc \
php-opcache \
php-memcached \
php-tidy \
php-pdo \
php-pdo-dblib \
php-pear \
php-pgsql \
php-process \
php-pecl-apcu \
php-pecl-geoip \
php-pecl-gmagick \
php-pecl-hrtime \
php-pecl-json \
php-pecl-memcache \
php-pecl-mongodb \
php-pecl-rar \
php-pecl-pq \
php-pecl-redis4 \
php-pecl-yaml \
php-pecl-zip
2-3 apache php연동 적용
systemctl restart httpd
3. apache 구동 에러 처리
Could not reliably determine the server's fully qualified domain name, using localhost.localdomain.
Set the 'ServerName' directive globally to suppress this message
echo "ServerName localhost" >> /etc/httpd/conf/httpd.conf
systemctl restart httpd
4. apache welcome 페이지 제거
mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf_disable
systemctl restart httpd
5. virtual host설정 5-1 홈디렉토리 생성
mkdir -p /var/www/virtual/[도메인주소]/htdocs/
5-2 virtual host설정
vi /etc/httpd/conf.d/[도메인주소].conf
ex)

    ServerAdmin test.com
    DocumentRoot /var/www/virtual/test.com/htdocs
    ServerName test.com
    ServerAlias test.com www.test.com 123.test.com 

5-3 virtualhost 작업용 ftp 계정생성
useradd ftpuser01
passwd ftpuser01


usermod -d /var/www/virtual -m ftpuser01

usermod -a -G apache ftpuser01

chgrp -R apache /var/www/virtual
chmod -R g+w /var/www/virtual

find /var/www/virtual -type d -exec chmod 2775 {} \;
find /var/www/virtual -type f -exec chmod ug+rw {} \;