Linux服務及安全管理第九周作業【Linux微職位】
1、請描述一次完整的http請求處理過程;
(1)建立或處理連接:接收請求或拒絕請求;
(2)接收請求:接收來自於網絡上的主機請求報文中對某特定資源的一次請求的過程;
(3)處理請求:對請求報文進行解析,獲取客戶端請求的資源及請求方法等相關信息;
(4)訪問資源:獲取請求報文中請求的資源;
(5)構建響應報文:
(6)發送響應報文:
(7)記錄日誌:
2、httpd所支持的處理模型有哪些,他們的分別使用於哪些環境。
MPM:Multipath Processing Modules(多路處理模塊)
(1)prefork:多進程模型,每個進程響應一個請求;
一個主進程:負責生成子進程及回收子進程;負責創建套接字;負責接收請求,並將其派發給某子進程進行處理;
n個子進程:每個子進程處理一個請求;
工作模型:會預先生成幾個空閑進程,隨時等待用於響應用戶請求;最大空閑和最小空閑;
特點及運用環境:每個工作進程響應一個用戶請求,即使當前沒有用戶請求,它亦會預先生成多個空閑進程,隨時等待請求連接,這樣的好處是服務器不用等到請求到達時,才去臨時建立進程,縮短了進程創建的時間,提高連接效率。但受限於linux的特性,工作進程數上限為1024個,如果超出該數量,服務器性能會急劇降低。因而,prefork模型的最大並發連接數量為1024。由於每個工作進程相對獨立,就算崩潰了也不會對其它進程有明顯影響。所以,該模型的特點是穩定可靠,適合於並發量適中而又追求穩定的用戶使用。
(2)worker:多進程多線程模型,每線程處理一個用戶請求;
一個主進程:負責生成子進程;負責創建套接字;負責接收請求,並將其派發給某子進程進行處理;
多個子進程:每個子進程負責生成多個線程;
每個線程:負責響應用戶請求;
並發響應數量:m*n
m:子進程數量
n:每個子進程所能創建的最大線程數量;
特點及運用環境:由於在linux中,原生不支持線程,且進程本身就足夠輕量化,與線程的區別不是很大,因而worker模型在linux環境中的實際性能表現與prefork相差無幾。
(3)event:事件驅動模型,多進程模型,每個進程響應多個請求;
一個主進程 :負責生成子進程;負責創建套接字;負責接收請求,並將其派發給某子進程進行處理;
子進程:基於事件驅動機制直接響應多個請求;
並發響應數量:m*n
m:子進程數量
n:每個子進程所能響應客戶請求數量;
httpd-2.2(CentOS 6):仍為測試使用模型;
httpd-2.4(CentOS 7):event可生產環境中使用;
特點及運用環境:event的並發數量和worker類似,同樣可達到m*n個。同時,因為event的子進程為一對多,節省大量CPU進程切換上下文的時間,也沒有了linux系統的1024個進程限制。所以,event模型是三種模型中效率最高的一種,可以突破10K的限制(即並發數1W),對海量的系統特別適用。
3、源碼編譯安裝LAMP環境(基於wordpress程序),並寫出詳細的安裝、配置、測試過程。
實驗環境:CentOS 7.2(192.168.1.11) + httpd-2.4.9 + mariadb-5.5.57 + php-5.4.26 + wordpress-4.8.1
1、安裝開發環境包組
[[email protected] ~]# yum groupinstall -y "Development Tools" "Server Platform Development"
2、安裝開發程序包
[[email protected] ~]# yum install -y openssl-devel pcre-devel
3、編譯安裝httpd-2.4.9(由於安裝http-2.4依賴於apr及apr-util 1.4以上版本,先對這2個軟件包進行編譯安裝)
(1)編譯安裝apr-1.5.0
[[email protected] ~]# tar xf apr-1.5.0.tar.bz2 [[email protected] ~]# cd apr-1.5.0/ [[email protected] apr-1.5.0]# ./configure --prefix=/usr/local/apr [[email protected] apr-1.5.0]# make && make install
(2)編譯安裝apr-util-1.5.3
[[email protected] ~]# tar xf apr-util-1.5.3.tar.bz2 [[email protected] ~]# cd apr-util-1.5.3/ [[email protected] apr-util-1.5.3]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr [[email protected] apr-util-1.5.3]# make && make install
(3)編譯安裝httpd-2.4.9
[[email protected] ~]# tar xf httpd-2.4.9.tar.bz2 [[email protected] ~]# cd httpd-2.4.9/ [[email protected] httpd-2.4.9]# ./configure --prefix=/usr/local/apache24 --sysconfdir=/etc/httpd24 --enable-so --enable-ssl --enable-cgi --enable-rewrite --enable-zlib --with-pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-modules=most --enable-mpms-shared=all --with-mpm=prefork [[email protected] httpd-2.4.9]# make && make install
(4)將新編譯的httpd24的bin目錄加入PATH環境變量並重新讀取該配置文件
[[email protected] ~]# vim /etc/profile.d/httpd24.sh export PATH=/usr/local/apache24/bin:$PATH [[email protected] ~]# . /etc/profile.d/httpd24.sh
(5)導出httpd頭文件鏈接至系統頭文件路徑/usr/include/apache24
[[email protected] ~]# ln -sv /usr/local/apache24/include/ /usr/include/apache24 ‘/usr/include/apache24’ -> ‘/usr/local/apache24/include/’
(6)用apache自帶的apachectl啟動編譯好的httpd,查看端口並測試自帶的測試頁面
[[email protected] ~]# apachectl start [[email protected] ~]# ss -tnl | grep :80 LISTEN 0 128 :::80 :::* [[email protected] ~]# curl http://192.168.1.11 <html><body><h1>It works!</h1></body></html>
4、編譯安裝mariadb-5.5.57
(1)準備數據目錄/mydata/data
[[email protected] ~]# mkdir -pv /mydata/data
(2)創建mysql用戶並修改數據目錄權限
[[email protected] ~]# id mysql id: mysql: no such user [[email protected] ~]# useradd -r mysql [[email protected] ~]# id mysql uid=988(mysql) gid=983(mysql) groups=983(mysql) [[email protected] ~]# chown -R mysql.mysql /mydata/data/ [[email protected] ~]# ls -ld /mydata/data/ drwxr-xr-x. 2 mysql mysql 6 Sep 23 16:44 /mydata/data/
(3)編譯安裝mariadb-5.5.57
[[email protected] ~]# tar xf mariadb-5.5.57-linux-systemd-x86_64.tar.gz -C /usr/local/ [[email protected] ~]# cd /usr/local/ [[email protected] local]# ln -sv mariadb-5.5.57-linux-systemd-x86_64/ mysql ‘mysql’ -> ‘mariadb-5.5.57-linux-systemd-x86_64/’ [[email protected] local]# cd mysql/ [[email protected] mysql]# chown -R root.mysql ./* [[email protected] mysql]# scripts/mysql_install_db --user=mysql --datadir=/mydata/data [[email protected] mysql]# ls /mydata/data/ aria_log.00000001 aria_log_control mysql performance_schema test
(4)為mysql提供配置文件
[[email protected] mysql]# cp support-files/my-large.cnf /etc/my.cnf cp: overwrite ‘/etc/my.cnf’? y [[email protected] mysql]# vim /etc/my.cnf
在[mysqld]下添加以下3個選項
datadir = /mydata/data innodb_file_per_table = ON skip_name_resolve = ON
(5)為mysql提供SysV服務
[[email protected] mysql]# cp support-files/mysql.server /etc/rc.d/init.d/mysqld [[email protected] mysql]# chkconfig --add mysqld
(6)將新編譯的mysql的bin目錄加入PATH環境變量並重新讀取該配置文件
[[email protected] mysql]# vim /etc/profile.d/mysql.sh export PATH=/usr/local/mysql/bin:$PATH [[email protected] mysql]# . /etc/profile.d/mysql.sh
(7)導出mysql頭文件鏈接至系統頭文件路徑/usr/include/mysql
[[email protected] ~]# ln -sv /usr/local/mysql/include /usr/include/mysql ‘/usr/include/mysql’ -> ‘/usr/local/mysql/include’
(8)添加mysql庫文件鏈接至系統頭文件路徑/usr/include/mysql
[[email protected] ~]# vim /etc/ld.so.conf.d/mysql.conf /usr/local/mysql/lib [[email protected] ~]# ldconfig -v [[email protected] ~]# ldconfig -p | grep mysql libmysqld.so.18 (libc6,x86-64) => /usr/local/mysql/lib/libmysqld.so.18 libmysqld.so (libc6,x86-64) => /usr/local/mysql/lib/libmysqld.so libmysqlclient.so.18 (libc6,x86-64) => /usr/lib64/mysql/libmysqlclient.so.18 libmysqlclient.so.18 (libc6,x86-64) => /usr/local/mysql/lib/libmysqlclient.so.18 libmysqlclient.so (libc6,x86-64) => /usr/local/mysql/lib/libmysqlclient.so
(9)啟動編譯好的mysqld服務,查看3306端口是否運行
[[email protected] ~]# service mysqld start [[email protected] ~]# ss -tnl | grep 3306 LISTEN 0 50 *:3306 *:*
5、編譯安裝php-5.4.26
(1)安裝編譯php需要用到的軟件包
[[email protected] ~]# yum install -y libxml2-devel libmcrypt-devel bzip2-devel
(2)編譯安裝php-5.4.26
[[email protected] ~]# tar xf php-5.4.26.tar.bz2 [[email protected] ~]# cd php-5.4.26/ [[email protected] php-5.4.26]# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-png-dir --with-jpeg-dir --with-freetype-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 [[email protected] php-5.4.26]# make && make install
(3)為php提供配置文件,編輯httpd配置文件使其支持php,並提供php測試頁
[[email protected] php-5.4.26]# cp php.ini-production /etc/php.ini [[email protected] php-5.4.26]# vim /etc/httpd24/httpd.conf AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps DirectoryIndex index.php index.html [[email protected] php-5.4.26]# vim /usr/local/apache24/htdocs/index.php <h1>phptest</h1> <?php phpinfo(); ?>
(4)重啟httpd服務,測試php測試頁是否能正常訪問
[[email protected] php-5.4.26]# apachectl restart
6、安裝配置wordpress-4.8.1
(1)下載並解壓wordpress-4.8.1至/usr/local/apache24/htdocs
[[email protected] ~]# wget https://cn.wordpress.org/wordpress-4.8.1-zh_CN.tar.gz [[email protected] ~]# tar xf wordpress-4.8.1-zh_CN.tar.gz -C /usr/local/apache24/htdocs/ [[email protected] ~]# chown -R root.root /usr/local/apache24/htdocs/wordpress/ [[email protected] ~]# cd /usr/local/apache24/htdocs/wordpress/
(2)為wordpress提供php配置文件,創建wpdb數據庫及授權相關權限
[[email protected] wordpress]# cp wp-config-sample.php wp-config.php [[email protected] wordpress]# vim wp-config.php define(‘DB_NAME‘, ‘wpdb‘); define(‘DB_USER‘, ‘wpuser‘); define(‘DB_PASSWORD‘, ‘wppassword‘); [[email protected] ~]# mysql Welcome to the MariaDB monitor. Commands end with ; or \g. Your MariaDB connection id is 2 Server version: 5.5.57-MariaDB MariaDB Server Copyright (c) 2000, 2017, Oracle, MariaDB Corporation Ab and others. Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement. MariaDB [(none)]> create database wpdb; Query OK, 1 row affected (0.08 sec) MariaDB [(none)]> grant all on wpdb.* to ‘wpuser‘@‘localhost‘ identified by ‘wppassword‘; Query OK, 0 rows affected (0.05 sec) MariaDB [(none)]> flush privileges; Query OK, 0 rows affected (0.04 sec) MariaDB [(none)]> exit Bye
(3)網頁瀏覽器中鍵入http://192.168.1.11/wordpress/,設置註冊用戶的用戶名和密碼,完成安裝wordPress
4、建立httpd服務器(基於編譯的方式進行),要求:
提供兩個基於名稱的虛擬主機:
(a)www1.stuX.com,頁面文件目錄為/web/vhosts/www1;錯誤日誌為/var/log/httpd/www1.err,訪問日誌為/var/log/httpd/www1.access;
(b)www2.stuX.com,頁面文件目錄為/web/vhosts/www2;錯誤日誌為/var/log/httpd/www2.err,訪問日誌為/var/log/httpd/www2.access;
(c)為兩個虛擬主機建立各自的主頁文件index.html,內容分別為其對應的主機名;
(d)通過www1.stuX.com/server-status輸出httpd工作狀態相關信息,且只允許提供帳號密碼才能訪問(status:status);
1、編譯安裝httpd請參考第3題
2、編輯配置httpd配置文件註視DocumentRoot並開啟vhosts
[[email protected] ~]# vim /etc/httpd24/httpd.conf #DocumentRoot "/usr/local/apache24/htdocs" Include /etc/httpd24/extra/httpd-vhosts.conf
3、創建2個虛擬主機頁面文件目錄、日誌目錄,並提供主頁文件index.html
[[email protected] ~]# mkdir -pv /web/vhosts/www{1,2} [[email protected] ~]# mkdir /var/log/httpd/ [[email protected] ~]# echo www1.stu110.com > /web/vhosts/www1/index.html [[email protected] ~]# echo www2.stu110.com > /web/vhosts/www2/index.html
4、編輯vhosts配置文件,創建兩個基於名稱的虛擬主機,指定相應的日誌文件,並設置server-status
[[email protected] ~]# vim /etc/httpd24/extra/httpd-vhosts.conf <VirtualHost *:80> DocumentRoot "/web/vhosts/www1" ServerName www1.stu110.com ErrorLog "/var/log/httpd/www1.err" CustomLog "/var/log/httpd/www1.access" common <Directory "/web/vhosts/www1"> Options None AllowOverride None Require all granted </Directory> <Location /server-status> SetHandler server-status AuthType Basic AuthName "Server Status" AuthUserFile "/etc/httpd24/.htpasswd" Require valid-user </Location> </VirtualHost> <VirtualHost *:80> DocumentRoot "/web/vhosts/www2" ServerName www2.stu110.com ErrorLog "/var/log/httpd/www2.err" CustomLog "/var/log/httpd/www2.access" common <Directory "/web/vhosts/www2"> Options None AllowOverride None Require all granted </Directory> </VirtualHost>
5、生成server-status認證用到的密碼文件
[[email protected] ~]# htpasswd -c -m /etc/httpd24/.htpasswd status New password: Re-type new password: Adding password for user status
6、編輯hosts文件,添加主機記錄
[[email protected] ~]# vim /etc/hosts 192.168.1.11 www1.stu100.com 192.168.1.11 www2.stu100.com
7、檢查配置文件,重啟httpd服務並測試
[[email protected] ~]# httpd -t Syntax OK [[email protected] ~]# apachectl restart [[email protected] ~]# curl www1.stu100.com www1.stu110.com [[email protected] ~]# curl www2.stu100.com www2.stu110.com
5、為第4題中的第2個虛擬主機提供https服務,使得用戶可以通過https安全的訪問此web站點;
(1)要求使用證書認證,證書中要求使用的國家(CN)、州(HA)、城市(ZZ)和組織(MageEdu);
(2)設置部門為Ops,主機名為www2.stuX.com,郵件為[email protected];
1、創建私有CA,簽署並頒發證書
[[email protected] ~]# cd /etc/pki/CA/ [[email protected] CA]# touch index.txt [[email protected] CA]# echo 01 > serial [[email protected] CA]# (umask 077; openssl genrsa -out /etc/pki/CA/private/cakey.pem 2048) Generating RSA private key, 2048 bit long modulus ..........................................................+++ .................................................................................+++ e is 65537 (0x10001) [[email protected] CA]# openssl req -new -x509 -key /etc/pki/CA/private/cakey.pem -days 365 -out /etc/pki/CA/cacert.pem You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter ‘.‘, the field will be left blank. ----- Country Name (2 letter code) [XX]:CN State or Province Name (full name) []:HA Locality Name (eg, city) [Default City]:ZZ Organization Name (eg, company) [Default Company Ltd]:MageEdu Organizational Unit Name (eg, section) []:Ops Common Name (eg, your name or your server‘s hostname) []:www2.stu110.com Email Address []:[email protected] [[email protected] CA]# cd /etc/httpd24/ [[email protected] httpd24]# mkdir ssl [[email protected] httpd24]# cd ssl [[email protected] ssl]# (umask 077;openssl genrsa -out httpd.key 2048) Generating RSA private key, 2048 bit long modulus .....................................+++ ...................................+++ e is 65537 (0x10001) [[email protected] ssl]# openssl req -new -key httpd.key -out httpd.csr You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter ‘.‘, the field will be left blank. ----- Country Name (2 letter code) [XX]:CN State or Province Name (full name) []:HA Locality Name (eg, city) [Default City]:ZZ Organization Name (eg, company) [Default Company Ltd]:MageEdu Organizational Unit Name (eg, section) []:Ops Common Name (eg, your name or your server‘s hostname) []:www2.stu110.com Email Address []:[email protected] Please enter the following ‘extra‘ attributes to be sent with your certificate request A challenge password []: An optional company name []: [[email protected] ssl]# openssl ca -in /etc/httpd24/ssl/httpd.csr -out /etc/pki/CA/certs/httpd.crt -days 365 Using configuration from /etc/pki/tls/openssl.cnf Check that the request matches the signature Signature ok Certificate Details: Serial Number: 1 (0x1) Validity Not Before: Sep 23 14:02:30 2017 GMT Not After : Sep 23 14:02:30 2018 GMT Subject: countryName = CN stateOrProvinceName = HA organizationName = MageEdu organizationalUnitName = Ops commonName = www2.stu110.com emailAddress = [email protected] X509v3 extensions: X509v3 Basic Constraints: CA:FALSE Netscape Comment: OpenSSL Generated Certificate X509v3 Subject Key Identifier: F1:62:C9:95:0C:45:BA:BC:83:D7:41:54:F1:5C:93:7B:25:BB:6A:FB X509v3 Authority Key Identifier: keyid:D0:5E:8F:AD:FC:62:2C:0E:46:78:C0:A7:7E:EC:95:7A:80:00:D9:3D Certificate is to be certified until Sep 23 14:02:30 2018 GMT (365 days) Sign the certificate? [y/n]:y 1 out of 1 certificate requests certified, commit? [y/n]y Write out database with 1 new entries Data Base Updated [[email protected] ssl]# cp /etc/pki/CA/certs/httpd.crt /etc/httpd24/ssl/ [[email protected] ssl]# ls httpd.crt httpd.csr httpd.key
2、安裝ssl模塊,刪除www2.stu110.com在httpd-vhosts中的定義,在主配置文件中啟用ssl模塊,並為www2.stu110.com配置ssl
[[email protected] ~]# yum install -y mod_ssl [[email protected] ~]# vim /etc/httpd24/httpd.conf LoadModule ssl_module modules/mod_ssl.so Include /etc/httpd24/extra/httpd-ssl.conf [[email protected] ~]# vim /etc/httpd24/extra/httpd-ssl.conf Listen 443 SSLPassPhraseDialog builtin <VirtualHost *:443> DocumentRoot "/web/vhosts/www2" ServerName www2.stu110.com:443 ErrorLog "/var/log/httpd/www2.err" CustomLog "/var/log/httpd/www2.access" common SSLEngine on SSLCertificateFile /etc/httpd24/ssl/httpd.crt SSLCertificateKeyFile /etc/httpd24/ssl/httpd.key <Directory "/web/vhosts/www2"> Options None AllowOverride None Require all granted </Directory> </VirtualHost>
3、檢查配置文件,重啟httpd服務並測試
[[email protected] ~]# httpd -t Syntax OK [[email protected] ~]# apachectl restart
網頁瀏覽器中鍵入https://www2.stu100.com/
6、在LAMP架構中,請分別以php編譯成httpd模塊形式和php以fpm工作為獨立守護進程的方式來支持httpd,列出詳細的過程。
實驗環境:CentOS 7.2(192.168.1.11) + httpd-2.4.9 + mariadb-5.5.57 + php-5.4.26
1、編譯安裝httpd、mariadb參考第3題
2、安裝編譯php需要用到的軟件包
[[email protected] ~]# yum install -y libxml2-devel libmcrypt-devel bzip2-devel
3、下載並解壓php-5.4.26
[[email protected] ~]# tar xf php-5.4.26.tar.bz2 [[email protected] ~]# cd php-5.4.26/
4、php編譯成httpd模塊形式
(1)通過--with-apxs2=/usr/local/apache24/bin/apxs選項,指定將php編譯成http的模塊形式
[[email protected] php-5.4.26]# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-png-dir --with-jpeg-dir --with-freetype-dir --with-zlib --with-libxml-dir=/usr --enable-xml --enable-sockets --with-apxs2=/usr/local/apache24/bin/apxs --with-mcrypt --with-config-file-path=/etc --with-config-file-scan-dir=/etc/php.d --with-bz2 [[email protected] php-5.4.26]# make && make install
(2)為php提供配置文件,編輯httpd配置文件使其支持php,並提供php測試頁
[[email protected] php-5.4.26]# cp php.ini-production /etc/php.ini [[email protected] php-5.4.26]# vim /etc/httpd24/httpd.conf
添加php文件類型
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps DirectoryIndex index.php index.html [[email protected] php-5.4.26]# vim /usr/local/apache24/htdocs/index.php <h1>phptest</h1> <?php phpinfo(); ?>
(3)重啟httpd服務,測試php測試頁是否能正常訪問
[[email protected] php-5.4.26]# apachectl restart
5、php以fpm工作為獨立守護進程的方式來支持httpd
(1)通過--enable-fpm選項,指定php以fpm工作為獨立守護進程的方式來支持httpd
[[email protected] php-5.4.26]# ./configure --prefix=/usr/local/php --with-mysql=/usr/local/mysql --with-openssl --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-mbstring --with-png-dir --with-jpeg-dir --with-freetype-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 [[email protected] php-5.4.26]# make && make install
(2)為php-fpm提供配置文件
[[email protected] php-5.4.26]# cp php.ini-production /etc/php.ini [[email protected] php-5.4.26]# cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf
(3)為php-fpm提供SysV服務
[[email protected] php-5.4.26]# cp sapi/fpm/init.d.php-fpm /etc/rc.d/init.d/php-fpm [[email protected] php-5.4.26]# chmod +x /etc/rc.d/init.d/php-fpm [[email protected] php-5.4.26]# chkconfig --add php-fpm [[email protected] php-5.4.26]# service php-fpm start Starting php-fpm done [[email protected] php-5.4.26]# netstat -antup | grep php-fpm tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 35116/php-fpm: mast
(4)編輯httpd配置文件使其啟用php-fpm模塊,並提供php測試頁
[[email protected] php-5.4.26]# vim /etc/httpd24/httpd.conf
取消以下2行前的註釋
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_fcgi_module modules/mod_proxy_fcgi.so
添加php文件類型,並使php文件通過fpm訪問
AddType application/x-httpd-php .php AddType application/x-httpd-php-source .phps DirectoryIndex index.php index.html ProxyRequests Off ProxyPassMatch ^/(.*\.php)$ fcgi://127.0.0.1:9000/usr/local/apache24/htdocs/$1 [[email protected] php-5.4.26]# vim /usr/local/apache24/htdocs/index.php <h1>phpfpmtest</h1> <?php phpinfo(); ?>
(5)重啟httpd服務,測試php測試頁是否能正常訪問
[[email protected] php-5.4.26]# apachectl restart
Linux服務及安全管理第九周作業【Linux微職位】