server-side/apache

Apache2 php7.2-fpm (1)

C/H 2018. 6. 22. 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

php7.2-fpm.username.sock 생성

sudo vi /etc/php/7.2/fpm/pool.d/username.conf
[username]
    user = username
    group = username
    listen = /run/php/php7.2-fpm.username.sock
    listen.owner = username
    listen.group = username
    
    pm = dynamic
    pm.max_children = 5
    pm.start_servers = 2
    pm.min_spare_servers = 1
    pm.max_spare_servers = 3

php7.2-fpm 실행

sudo systemctl restart php7.2-fpm
ll /var/run/php/
php7.2-fpm.pid
php7.2-fpm.sock=
php7.2-fpm.username.sock=

sudo a2enmod actions fastcgi
sudo vi /etc/apache2/sites-available/username.conf

/etc/apache2/sites-available/username.conf 추가

<IfModule mod_fastcgi.c>

    AddHandler php7-fcgi-username .php
    Action php7-fcgi-username /php7-fcgi-username
    Alias /php7-fcgi-username /usr/lib/cgi-bin/php7-fcgi-username
    FastCgiExternalServer /usr/lib/cgi-bin/php7-fcgi-username -socket /run/php/php7.0-fpm.username.sock -pass-header Authorization

        <Directory "/usr/lib/cgi-bin">
            Require all granted
        </Directory>
    </IfModule>

virtualhost 설정

sudo vi /etc/apache2/sites-available/com.domain.conf
<VirtualHost *:80>                                                              
    ServerName domain.com                                                      
    ServerAdmin username@domain.com                                               
    DocumentRoot /home/uncaose/www/com.doamin           
                                                                                
    ErrorLog ${APACHE_LOG_DIR}/com.domain.error.log                            
    CustomLog ${APACHE_LOG_DIR}/com.domain.access.log combined                 
                                                                                
    <Directory /home/uncaose/www/com.doamin>            
        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>                                                             
        <IfModule mod_fastcgi.c>                                                
            <FilesMatch ".+\.ph(p[345]?|t|tml)$">                               
                SetHandler php7-fcgi-uncaose                                    
            </FilesMatch>                                                       
        </IfModule>                                                             
    </Directory>                                                                
</VirtualHost>

domain.com 확인

sudo a2dismod php7.0 php7.1
sudo a2enmod php7.2 rewrite action proxy proxy_fcgi
sudo a2dissite 000-default
sudo a2ensite com.domain
sudo systemctl restart apache2


반응형

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

Apache2 php7.2-fpm (2)  (0) 2018.06.23
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