Lnmp1.0 supports pathinfo Mode

Source: Internet
Author: User

First, execute


Touch/usr/local/nginx/CONF/pathinfo. conf create the pahtinfo. conf file

Add the following content to the file:


Set $ real_script_name $ fastcgi_script_name;
If ($ fastcgi_script_name ~ "(. +? \. Php )(/.*)"){
Set $ real_script_name $1;
Set $ path_info $2;
}
Fastcgi_param script_filename $ document_root $ real_script_name;
Fastcgi_param script_name $ real_script_name;
Fastcgi_param path_info $ path_info ~ . * \. (PhP | PhP5 )? $ Replace with: Location ~ . * \. Php

Add a line of include pathinfo. conf in include fcgi. conf;

Restart nginx
The complete VM configuration file is as follows:

Server
{
Listen 80;
SERVER_NAME iw3c.com;
Index index.html index.htm index. php;
Root/home/wwwroot/iw3c;

Location ~ . * \. Php
{
Try_files $ uri = 404;
Fastcgi_pass Unix:/tmp/php-cgi.sock;
Fastcgi_index index. php;
Fcinclude gi. conf;
Include pathinfo. conf;
}

Location/status {
Stub_status on;
Access_log off;
}

Location ~ . * \. (GIF | JPG | JPEG | PNG | BMP | SWF) $
{
Expires 30d;
}

Location ~ . * \. (JS | CSS )? $
{
Expires 12 h;
}

}

Lnmp1.0 supports pathinfo Mode

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.