Heim  >  Artikel  >  Backend-Entwicklung  >  nginx使用sock形式调用php-fpm

nginx使用sock形式调用php-fpm

WBOY
WBOYOriginal
2016-06-13 12:11:26956Durchsuche

nginx使用sock方式调用php-fpm

 通常我们配置nginx默认连接php-fpm的方式,是监听127.0.0.1:9000端口,然而还有一种更高效的连接方式,用sock的方式连接。配置如下:

    

    第一步,nginx端配置方法:

    location ~ .*\.(php|php5)?$

        {

        fastcgi_pass unix:/dev/shm/php-fpm.sock;

        fastcgi_index index.php;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;

        include fastcgi_params;

        }

        

    第二步,php端配置方法:

        

    5.2以下版本php-fpm.conf配置:

        /dev/shm/php-fpm.sock


    5.3以上版本php-fpm.conf配置:

        listen = /dev/shm/php-fpm.sock


    重启nginx,php生效。

欢迎大家访问我的个人网站 萌萌的IT人
Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn