Configuration of the nginx+php

Source: Internet
Author: User

nginx+php configuration is relatively simple, the core is a word----

Forward the requested information to the 9000-port PHP process,

Let the PHP process handle the PHP file under the specified directory.

Here's an example:

Location ~ \. php$ {            // root             html;            Fastcgi_pass   127.0.0.1:9000;            Fastcgi_index  index. php;            Fastcgi_param  script_filename  $document _root$fastcgi_script_name;             include         fastcgi_params;        }

1: Encountered PHP file,

2: Locate the root directory to HTML,

3: Transfer the request context to the 9000 port PHP process,

4: And tell the PHP process that the current script is $document _root$fastcgi_scriptname

Configure Nginx support PathInfo so that the/NEWS/1 of the TP framework can be supported

Location ~ \.php (. *) $ {            // root directory             rooted html;            Fastcgi_pass   127.0.0.1:9000;            Fastcgi_index  index. php;            Fastcgi_param  script_filename  $document _root$fastcgi_script_name;            Fastcgi_param  path_info $1;             include         fastcgi_params;        }

Configuring Nginx overrides (using regular expressions)

Try_files method Implementation Overrides

means that

Let's try this directory for/goods/1/.

Try again, there's no/goods/1 this file.

Finally try/index.php?goods/1 this URL

Configuration of the nginx+php

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.