第十二周课堂练习下
6、在LAMP架构中,请分别以php编译成httpd模块形式和php以fpm工作为独立守护进程的方式来支持httpd,列出详细的过程
1.模块方式安装可见第三节
2.fpm独立守护进程安装
[root@LAMP setup]# tar -xf php-5.6.23.tar.bz2 ##编译 [root@LAMP php-5.6.23]#./configure –prefix=/usr/local/php5 –with-mysql=mysqlnd –with-openssl –with-mysqli=mysqlnd –enable-mbstring –with-freetype-dir –with-jpeg-dir –with-png-dir –with-zlib –with-libxml-dir=/usr –enable-xml –enable-sockets –enable-fpm –with-mcrypt –with-config-file-path=/etc –with-config-file-scan-dir=/etc/php.d –with-bz2 ##以fpm模式运行,使能fpm选项,–enable-fpm, –with-apxs2一项就不需要启用了 [root@LAMP php-5.6.23]#make [root@LAMP php-5.6.23]#make install ##copy配置文件到/etc目录 [root@LAMP php-5.6.23]# cp php.ini-production /etc/php.ini ##php-fpm配置文件,取消pid的注释 [root@LAMP etc]# cp /usr/local/php5/etc/php-fpm.conf.default /usr/local/php5/etc/php-fpm.conf pid = /usr/local/php5/var/run/php-fpm.pid [root@LAMP fpm]# cp php-5.4.26/sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm [root@LAMP system]# chkconfig --add php-fpm [root@LAMP system]# service php-fpm start 修改/etc/httpd24/httpd24.conf配置文件 LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps <VirtualHost 192.168.180.130:8080> ServerName www.a.com DocumentRoot /usr/local/apache24/htdocs/ ProxyRequests Off ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache24/htdocs/$1 <Directory "/usr/local/apache24/htdocs/"> Options indexes AllowOverride None Require all granted </Directory> </VirtualHost>