First, PathInfo support method
1.2 Version of the system has automatically generated a pathinfo configuration file, but the actual measurement is not available, so we first find this file and modify its contents, the file path is:/usr/local/nginx/pathinfo.conf, the content is modified as follows:
Set $path _info ""; #定义变量 $real _script_name for storing the real address set $real _script_name $fastcgi _script_name; #如果地址与引号内的正则表达式匹配if ($ Fastcgi_script_name ~ "^ (. +?\.php) (/.+) $") {#将文件地址赋值给变量 $real _script_nameset $real _script_name $; #将文件地址后的参数赋值给变量 $ Path_infoset $path _info;} #配置fastcgi的一些参数fastcgi_param script_filename $document _root$real_script_name;fastcgi_param script_name $real _ Script_name;fastcgi_param path_info $path _info;
Then find your own configuration file to support the PathInfo Web site, the file path is:/user/local/nginx/vhost/**.conf, found in the file "#include pathinfo.conf;" This line, will be # removed.
Restart Nginx, the command is:/etc/init.d/nginx Restart, after the successful restart can use PathInfo way to access the site.
Second, add rewrite support method
Locate the configuration file to support the Web site, the file path is:/user/local/nginx/vhost/**.conf, if the host was created when the rewrite configuration file has been set, then directly modify the previously selected configuration file, no, You can create a new other.conf rewrite profile that can be used directly by other sites later.
In the configuration file, locate the "root/home/wwwroot/your site root", this code, and then add an "include other.conf;" in the following sentence.
Return nginx configuration Directory "/usr/local/nginx/conf/", if there is already exist other.conf directly overwrite the contents of the content, does not exist the new.
The contents of the other.conf are as follows:
Location/{ if (!-e $request _filename) { rewrite ^ (. *) $/index.php/$1; }}
Restart Nginx, "/etc/init.d/nginx restart", re-visit the site can be omitted index.php.
lnmp1.2 supports thinkphp pathinfo and rewrite