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.service1-1 apache info, status 활성화 및 접속 정책 할당
vi /etc/httpd/conf.d/status_info.conf
2. php 설치 2-1 php 7.3 설치 repogitory 등록SetHandler server-status Order deny,allow Deny from all Allow from [접속IP] SetHandler server-info Order deny,allow Deny from all Allow from [접속IP]
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-php732-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-zip2-3 apache php연동 적용
systemctl restart httpd3. 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 httpd4. apache welcome 페이지 제거
mv /etc/httpd/conf.d/welcome.conf /etc/httpd/conf.d/welcome.conf_disable systemctl restart httpd5. virtual host설정 5-1 홈디렉토리 생성
mkdir -p /var/www/virtual/[도메인주소]/htdocs/5-2 virtual host설정
vi /etc/httpd/conf.d/[도메인주소].confex)
5-3 virtualhost 작업용 ftp 계정생성ServerAdmin test.com DocumentRoot /var/www/virtual/test.com/htdocs ServerName test.com ServerAlias test.com www.test.com 123.test.com
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 {} \;