Nginx deployment thinkphp Do something, configure the Pathinfo mode, and finally well equipped

Source: Internet
Author: User
Use thinkphp made a website, deploy to Ubuntu when need, server with Nginx, itself does not support pathinfo mode, need to modify the configuration file, so that it can use PathInfo.

I'm using a virtual hosting method. Before the configuration for a long time, always appear a variety of problems, and finally really not, directly with rewrite mode, configuration is relatively simple. Later did not know what changed, rewrite also can not use, this is going to put

PathInfo to come out, so looked up all kinds of information, 1.1 points of change. Finally changed.

Found a lot of online things, in fact, and their own use often will be a little different, need to be based on their own things to modify the line

Server {Listen8082; Root/usr/share/nginx/www/SSDF;        Index index.php index.html index.htm; Error_page404/404. html; 404 and Back "/" need to have a space separated by#Pass the PHP scripts to FastCGI server listening on the PHP-FPM socketLocation/{//Here is rewrite rule, can be used alone, thinkphp mode also to change to rewrite,if(!-E$request _filename) {//Before the configuration, I do not know later changed that can not be used. Rewrite ^/(. *) $/index.php/ $Last ;  Break; }} Location ~ ^ (.+\.php) (. *) {#try_files $uri = 404; This sentence just tried to comment out, and then did not try to comment can not be used#Fastcgi_pass 127.0.0.1:9000; Here at the beginning of the words written, and then modified to the default file in the following sentence, this sentence does not know how to use the two sentencesFastcgi_pass unix:/run/php5-Fpm.sock; Fastcgi_index index.php;# include fastcgi_params; The contents of Fastcgi_params and fcgi.conf are the same, the two names on the internet are used by people                include fcgi.conf; Set                $real _script_name$fastcgi _script_name; Set$path _info""; if($fastcgi _script_name~"^ (. +?\.php) (/.+) $"{//if statement must have a space after it, to be separated from other areas, belong to the grammar rules set$real _script_name $; Set$path _info $; } Fastcgi_param script_filename$document _root$real_script_name; Fastcgi_param Script_name$real _script_name; Fastcgi_param Path_info$path _info; }}

The above describes the Nginx deployment thinkphp do things, configuration Pathinfo mode, and finally well, including the content, I hope that the PHP tutorial interested in a friend helpful.

  • 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.