ini 使用php-fpm对nginx进行默认配置

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ini 使用php-fpm对nginx进行默认配置相关的知识,希望对你有一定的参考价值。

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root "/home/vagrant";
    index index.php index.html index.htm;

    server_name site;

    location ~ \.php$ {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;

        # With php5-fpm:
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_index index.php;
        fastcgi_param   PATH_INFO               $fastcgi_path_info;
        fastcgi_param   SCRIPT_FILENAME         $document_root$fastcgi_script_name;
        fastcgi_param   PATH_TRANSLATED         $document_root$fastcgi_script_name;
        include fastcgi_params;
    }

    location / {
        try_files $uri $uri/ =404;
    }

    location /phpmyadmin {
           root /usr/share/;
           index index.php index.html index.htm;
           location ~ ^/phpmyadmin/(.+\.php)$ {
               try_files $uri =404;
         	fastcgi_pass unix:/var/run/php5-fpm.sock;
      		root /usr/share/;
               fastcgi_index index.php;
               fastcgi_param SCRIPT_FILENAME $request_filename;
               include /etc/nginx/fastcgi_params;
           }
           location ~* ^/phpmyadmin/(.+\.(jpg|jpeg|gif|css|png|js|ico|html|xml|txt))$ {
               root /usr/share/;
           }
    }
}

以上是关于ini 使用php-fpm对nginx进行默认配置的主要内容,如果未能解决你的问题,请参考以下文章

ini Nginx PHP-FPM Symfony 2最小配置

ini boxen / brew nginx开发配置w / fastcgi php-fpm

php.ini优化,,,php-fpm

ini 使用php进行nginx默认配置

php-fpm 配置文件检测

nginx + php-fpm 高并发配置 (也包括一部分apache/httpd)