IT이야기
Apache + PHP 여러 버전 사용 설정 방법
영은파더♥
2020. 7. 28. 11:36
728x90
Apache + PHP-FPM + mod_fcgid 로 multiple version 설정이 가능합니다.
하지만 유저권한 설정이 apache user group 으로 설정하여야 해서 보안에 문제가 있어보입니다.
이번에는 nginx 설정 처럼 도메인별로 유저권한을 설정하는 방법입니다.
cp /etc/opt/remi/php73/php-fpm.d/www.conf /etc/opt/remi/php73/php-fpm.d/example1.conf
cp /etc/opt/remi/php73/php-fpm.d/www.conf /etc/opt/remi/php73/php-fpm.d/example2.conf
기존 파일을 하나 복사해서 편집합니다.
[www]
==>
[www.example1.com]
user = apache
group = apache
==>
user = example1
group = example1
listen = 127.0.0.1:9000
==>
listen = 127.0.0.1:9001
[www]
==>
[www.example2.com]
user = apache
group = apache
==>
user = example2
group = example2
listen = 127.0.0.1:9000
==>
listen = 127.0.0.1:9002
포트는 각 유저당 1개씩 사용이 됩니다.
vi /etc/httpd/conf.d/example.conf
<VirtualHost *:80>
ServerName www.example1.com
ServerAlias example1.com \
*.example1.com
DocumentRoot /home/example1/www
#SetHandler "proxy:fcgi://127.0.0.1:9001/"
ProxyPassMatch ^/(.*\.(php|htm|html)(/.*)?)$ fcgi://127.0.0.1:9001/home/example1/www/$1
</VirtualHost>
<VirtualHost *:80>
ServerName www.example2.com
ServerAlias example2.com \
*.example2.com
DocumentRoot /home/example2/www
#SetHandler "proxy:fcgi://127.0.0.1:9002/"
ProxyPassMatch ^/(.*\.(php|htm|html)(/.*)?)$ fcgi://127.0.0.1:9002/home/example2/www/$1
</VirtualHost>
SetHandler 를 사용하는 방법과 ProxyPassMatch 를 사용하는 방법이 있습니다.
nginx 설정 방법은 itrooms.tistory.com/972 여기를 참고하세요~
728x90
반응형