溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務(wù)條款》

centos中如何安裝php fpm

發(fā)布時間:2020-11-20 10:36:21 來源:億速云 閱讀:172 作者:小新 欄目:編程語言

小編給大家分享一下centos中如何安裝php fpm,相信大部分人都還不怎么了解,因此分享這篇文章給大家參考一下,希望大家閱讀完這篇文章后大有收獲,下面讓我們一起去了解一下吧!

centos安裝php fpm的方法:首先通過“yum install -y php-fpm”安裝“php-fpm”;然后通過“systemctl start php-fpm”啟動“php-fpm”即可。

centos7系統(tǒng)下安裝php-fpm并配置nginx支持并開啟網(wǎng)站gzip壓縮

注:此處不介紹nginx的安裝。以下教程默認(rèn)已安裝nginx。

1.

yum install -y php-fpm
yum install php-pdo yum install php-mysql
yum install php-xml

yum安裝默認(rèn)版本是php5.4,要使用更高版本可使用yum search all php-fpm安裝自己需要的版本.

2.

啟動php-fpm(注:php-fpm默認(rèn)端口9000)

systemctl start php-fpm

3.

配置nginx使支持php-fpm并開始網(wǎng)站gzip壓縮,修改nginx.cong:

centos中如何安裝php fpm

具體如下:

    # 開啟gzip壓縮
    gzip on;
    gzip_min_length 1k;
    gzip_buffers 4 16k;
    # gzip_http_version 1.0;
    gzip_comp_level 2;
    gzip_types text/plain application/x-javascript text/css application/xml text/javascript application/x-httpd-php image/jpeg image/gif image/png;
    gzip_vary off;
    gzip_disable "MSIE [1-6]\.";
        location / {
            root   /var/www/html;
            index  index.php index.html index.htm;
        }
        #此配置使nginx支持php
        location ~ \.php$ {
            root /var/www/html; #指定php的根目錄
            fastcgi_pass 127.0.0.1:9000;#php-fpm的默認(rèn)端口是9000
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }

然后重啟nginx即可!注:php-fpm默認(rèn)根目錄為:/var/www/html

以上是centos中如何安裝php fpm的所有內(nèi)容,感謝各位的閱讀!相信大家都有了一定的了解,希望分享的內(nèi)容對大家有所幫助,如果還想學(xué)習(xí)更多知識,歡迎關(guān)注億速云行業(yè)資訊頻道!

向AI問一下細(xì)節(jié)

免責(zé)聲明:本站發(fā)布的內(nèi)容(圖片、視頻和文字)以原創(chuàng)、轉(zhuǎn)載和分享為主,文章觀點不代表本網(wǎng)站立場,如果涉及侵權(quán)請聯(lián)系站長郵箱:is@yisu.com進(jìn)行舉報,并提供相關(guān)證據(jù),一經(jīng)查實,將立刻刪除涉嫌侵權(quán)內(nèi)容。

AI