第十二周課堂練習下
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>