server-side/apache

Apache2 php7.2-fpm (2)

C/H 2018. 6. 23. 08:30


php7.2-fpm 설치

Apache2 설치가 되어있다고 가정한다.

apt-get -y install libapache2-mod-fastcgi php7.2-fpm php7.2
...

sudo systemctl start php7.2-fpm
sudo systemctl enable php7.2-fpm
# sudo systemctl restart php7.2-fpm
# sudo systemctl stop php7.2-fpm
ll /var/run/php 
# /var/run/php/php7.2-fpm.sock=

sudo a2enmod proxy proxy_fcgi
<VirtualHost *:80>
ServerName domain.com
ServerAdmin username@domain.com
DocumentRoot /home/username/www/com.domain

ErrorLog ${APACHE_LOG_DIR}/com.domain.error.log
CustomLog ${APACHE_LOG_DIR}/com.domain.username.domain combined

    <Directory /home/username/www/com.domain>
        Options -Indexes +FollowSymLinks +MultiViews
        AllowOverride All
        Require all granted
        <IfModule mod_rewrite.c>
            RewriteEngine On
            RewriteBase /
            RewriteCond %{REQUEST_FILENAME} !-f·
            RewriteCond %{REQUEST_FILENAME} !-d·
            RewriteRule ^(.*)$ index.php?/$1 [L]·
        </IfModule>
    </Directory>
    <FilesMatch \.php$>
        SetHandler "proxy:unix:/var/run/php/php7.2-fpm.sock|fcgi://localhost/"
        #SetHandler "proxy:fcgi://127.0.0.1:9000"
    </FilesMatch>
</VirtualHost>

/etc/php/7.2/fpm/pool.d/www.conf 수정

; listen = /var/run/php/php7.2-fpm.sock
listen = 127.0.0.1:9000

#SetHandler "proxy:unix:/var/run/php/php7.2-fpm.sock|fcgi://localhost/"
SetHandler "proxy:fcgi://127.0.0.1:9000"
sudo systemctl restart php7.2-fpm
sudo systemctl restart apache2

listen = 127.0.0.1:9000
SetHandler "proxy:fcgi://127.0.0.1:9000"
위 설정으로는 getallheaders() 함수 에러가 발생한다. getallheaders 함수를 사용하지 않거나, PHPUnit - getallheaders not work 함수로 헤더를 이용할 수 있다.

반응형

'server-side > apache' 카테고리의 다른 글

Apache2 php7.2-fpm (1)  (0) 2018.06.22
CAUTION: provisional headers are shown (font)  (0) 2017.05.27
Chrome "CAUTION: Provisional headers are shown"  (0) 2017.05.18
아파치 성능도구 ab  (0) 2017.02.22
Mac XAMPP VirtualHost 설정  (0) 2015.12.28