Nginx supports Pathinfo for configuring PHP-FPM

Source: Internet
Author: User
Tags configuration php
If you have used php In nginx, you must know that nginx has never supported php pathinfo well. In the past, we used some handy methods to achieve this effect. In the end, we often need to work with php. set cgi in ini. fix_pathinfo1. In addition, this document has been messy. Basically, every document you find has its own

If you have used php In nginx, you must know that nginx has never supported php pathinfo well. In the past, we used some handy methods to achieve this effect. In the end, we often need to work with php. set cgi in ini. fix_pathinfo = 1. In addition, this document has been messy. Basically, every document you find has its own

If you have used php In nginx, you must know that nginx has never supported php pathinfo well. In the past, we used some handy methods to achieve this effect.php.iniSettingscgi.fix_pathinfo = 1. In addition, this document has been messy. Basically, each document you find has its own practice.

After upgrading nginx recently, I found that the official support for php-fpm has been greatly improved. Maybe this is a long time, however, forgive me for not having read the configuration file carefully in the 0.8 version.

Specifically, it addsfastcgi_split_path_infoIn this way, the configuration becomes very simple. Delete the previousserverFor phplocationConfigure and add the following content

        location ~ [^/]\.php(/|$) {                fastcgi_split_path_info ^(.+?\.php)(/.*)$;                fastcgi_pass unix:/var/run/php5-fpm.sock;                fastcgi_index index.php;                include fastcgi_params;        }

Note that the above Code passes the test in nginx 1.1.19.

Well, that's what it looks like. You don't need to customize a bunchfastcgi_param. Note: If you have enabledcgi.fix_pathinfo = 1Disable it.

Original address: Nginx configuration PHP-FPM support Pathinfo, thanks to the original author to share.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.