php5-fpmのインストール方法

藏色散人
リリース: 2023-03-08 20:34:02
オリジナル
2675 人が閲覧しました

php5-fpm のインストール方法: まず nginx をインストールして nginx ユーザーを作成し、次に php-fpm をサポートするように nginx 設定ファイルを変更し、次に「apt-get -y install」コマンド php5-fpm と php を使用します。 ; 最後にphp-fpm設定ファイルを変更します。

php5-fpmのインストール方法

この記事の動作環境:debian7.8システム、PHP5バージョン、DELL G3コンピュータ

nginx php5-fpmインストール

1. 基本環境

1、 cat  /etc/debian_version 
7.8
 
2、 uname  -r
3.2.0-4-amd64
 
3、ip(eth0)
10.0.0.109
ログイン後にコピー

4. nginxのバージョン

1.4.7
ログイン後にコピー

2. nginx

のインストール

1. 必要な基本パッケージをインストールします

apt-get -y  install  libpcre3-dev libpcre3 libssl-dev zlib1g-dev  make
ログイン後にコピー

2. nginx ユーザーを作成します

1)groupadd nginx
2) useradd  nginx -g nginx -s  /bin/false
ログイン後にコピー

3. nginx

axel -n 10 http: //nginx .org /download/nginx-1 .4.7. tar .gz
ログイン後にコピー
# をダウンロードします

##4. 解凍

tar  zxvf nginx-1.4.7. tar .gz &&  cd  nginx-1.4.7
ログイン後にコピー

5. 三部作のコンパイル

1). /configure  --prefix= /opt/nginx  --user=nginx --group=nginx --with-http_ssl_module
2) make  &&  make  install
ログイン後にコピー

6. パラメータの説明

--prefix= /opt/nginx     将安装路径指定在 /opt/nginx 
http_ssl_module         https协议模块
http_gzip_module        压缩的HTTP服务器的响应模块
http_rewrite_module     重写模块
--user=nginx            nginx用户 
--group=nginx           nginx组
ログイン後にコピー

7. 便宜上、ソフト リンク

ln  -s  /opt/nginx/sbin/nginx  /usr/local/sbin/nginx
ログイン後にコピー

[推奨:

PHP ビデオ チュートリアル ]

8. nginx 構成を変更するphp-fpm

1) 最初にバックアップを作成します

cp  /opt/nginx/conf/nginx .conf  /opt/nginx/conf/nginx .conf.bak
ログイン後にコピー

2) 次の内容を変更します

2c2
< user nginx;
---
>  #user  nobody;
36,39c36,38
<         listen       10.0.0.109:80;
<         server_name  10.0.0.109;
<         access_log  /opt/nginx/logs/10 .0.0.109.access.log;
<         error_log  /opt/nginx/logs/10 .0.0.109.error.log;
---
>         listen       80;
>         server_name  localhost;
> 
66,72c65,71
<         location ~ \.php$ {
<             root           html;
<             fastcgi_pass   unix: /run/shm/php5-fpm .sock;
<             fastcgi_index  index.php;
<             fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;
<             include        fastcgi_params;
<         }
---
>          #location ~ \.php$ {
>          #    root           html;
>          #    fastcgi_pass   127.0.0.1:9000;
>          #    fastcgi_index  index.php;
>          #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
>          #    include        fastcgi_params;
>          #}
ログイン後にコピー

9. nginx サービスを開始します

nginx
ログイン後にコピー

10. ポートとプロセスを確認します

1) netstat  -tupnl| grep  nginx
tcp        0      0 10.0.0.109:80           0.0.0.0:*               LISTEN      13852 /nginx : master
2) ps  -ef | grep  nginx
root     13852     1  0 22:51 ?        00:00:00 nginx: master process nginx
nginx    13853 13852  0 22:51 ?        00:00:00 nginx: worker process
nginx    13907 13906  0 22:52 ?        00:00:00 php-fpm: pool www                                         
nginx    13908 13906  0 22:52 ?        00:00:00 php-fpm: pool www
ログイン後にコピー

PS:

1. nginx サービスを停止します

nginx -s quit
ログイン後にコピー

2. 設定をリロードします

nginx -s reload
ログイン後にコピー

3. php5-fpm をインストールします

1. php5-fpm と php

apt-get -y  install  php5-cli
apt-get -y  install  php5-fpm
ログイン後にコピー

2. php-fpm をインストールします。 fpm 設定ファイル

1) 最初にバックアップを作成します

cp  /etc/php5/fpm/pool .d /www .conf  /etc/php5/fpm/pool .d /www .conf.bak
ログイン後にコピー

2) 次の内容を変更します

diff  /etc/php5/fpm/pool .d /www .conf  /etc/php5/fpm/pool .d /www .conf.bak 
22,23c22,23
< user = nginx
< group = nginx
---
> user = www-data
> group = www-data
33c33
< listen =  /run/shm/php5-fpm .sock
---
> listen =  /var/run/php5-fpm .sock
44,46c44,46
< listen.owner = nginx
< listen.group = nginx
< listen.mode = 0660
---
> listen.owner = www-data
> listen.group = www-data
> ;listen.mode = 0660
ログイン後にコピー

3. php-fpm サービスを再起動します

/etc/init .d /php5-fpm  restart
ログイン後にコピー

4. プロセスを確認します

ps  -ef | grep  php
root     13906     1  0 22:52 ?        00:00:00 php-fpm: master process ( /etc/php5/fpm/php-fpm .conf)      
nginx    13907 13906  0 22:52 ?        00:00:00 php-fpm: pool www                                         
nginx    13908 13906  0 22:52 ?        00:00:00 php-fpm: pool www
ログイン後にコピー

4. テスト用のphpファイルを書き込みます

cat  /opt/nginx/html/info .php 
<?php
phpinfo();
?>;
ログイン後にコピー

5. nginx 関連モジュールと参考記事

1. nginx 関連モジュール

ngx_http_core_module
ngx_http_access_module
ngx_http_addition_module
ngx_http_auth_basic_module
ngx_http_auth_request_module
ngx_http_autoindex_module
ngx_http_browser_module
ngx_http_charset_module
ngx_http_dav_module
ngx_http_empty_gif_module
ngx_http_f4f_module
ngx_http_fastcgi_module
ngx_http_flv_module
ngx_http_geo_module
ngx_http_geoip_module
ngx_http_gunzip_module
ngx_http_gzip_module
ngx_http_gzip_static_module
ngx_http_headers_module
ngx_http_hls_module
ngx_http_image_filter_module
ngx_http_index_module
ngx_http_limit_conn_module
ngx_http_limit_req_module
ngx_http_log_module
ngx_http_map_module
ngx_http_memcached_module
ngx_http_mp4_module
ngx_http_perl_module
ngx_http_proxy_module
ngx_http_random_index_module
ngx_http_realip_module
ngx_http_referer_module
ngx_http_rewrite_module
ngx_http_scgi_module
ngx_http_secure_link_module
ngx_http_session_log_module
ngx_http_spdy_module
ngx_http_split_clients_module
ngx_http_ssi_module
ngx_http_ssl_module
ngx_http_status_module
ngx_http_stub_status_module
ngx_http_sub_module
ngx_http_upstream_module
ngx_http_upstream_conf_module
ngx_http_userid_module
ngx_http_uwsgi_module
ngx_http_xslt_module
 
ngx_mail_core_module
ngx_mail_auth_http_module
ngx_mail_proxy_module
ngx_mail_ssl_module
ngx_mail_imap_module
ngx_mail_pop3_module
ngx_mail_smtp_module
 
ngx_stream_core_module
ngx_stream_access_module
ngx_stream_limit_conn_module
ngx_stream_proxy_module
ngx_stream_ssl_module
ngx_stream_upstream_module
ログイン後にコピー

2. 参考記事

http://nginx .org / en/docs

http://tengine .taabao.org /nginx_docs/cn/docs/http/ngx_http_core_module .html

以上がphp5-fpmのインストール方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

関連ラベル:
ソース:php.cn
このウェブサイトの声明
この記事の内容はネチズンが自主的に寄稿したものであり、著作権は原著者に帰属します。このサイトは、それに相当する法的責任を負いません。盗作または侵害の疑いのあるコンテンツを見つけた場合は、admin@php.cn までご連絡ください。
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!