Thankphp project is deployed under Nginx

Source: Internet
Author: User

Thankphp Project general deployment in lamp under General no problem, deployment in LNMP is a bit acclimatized,,, 404, ajax err,,, God horse

You need to modify the configuration of the Nginx:

#方法一:[email protected]:/etc/nginx/sites-enabled$ sudo cat  default [sudo]  password for kkk: server {    listen 80 default_server;     root /data/www/t1;    index index.php index.html  index.htm;    server_name localhost;    location /  {    #    try_files  $uri   /index.php$url;             if  (!-e  $request _filename)  {                  rewrite   ^/(. *) $  /index.php/$1  last;                  break;               }       }        location  ~ \.php/?. *$ {           #root          /var/www/html/website;          fastcgi_pass    127.0.0.1:9001;          fastcgi_index   index.php;           #加载Nginx默认 "Server environment variables" configuration            include         fastcgi.conf;                      #设置PATH_INFO并改写SCRIPT_FILENAME, script_name server environment variables            set  $fastcgi _script_name2  $fastcgi _script_name;           if  ($fastcgi _script_name ~  "^ (. +\.php) (/.+) $")  {               set  $fastcgi _script_name2 $1 ;              set  $path _info  $2;          }           fastcgi_param   PATH_INFO  $path _info;           fastcgi_param   SCRIPT_FILENAME    $document _root$ fastcgi_script_name2;          fastcgi_param    SCRIPT_NAME    $fastcgi _script_name2;      }    }#----------------------------------------------------------------------------------#方法二:[email  Protected]:/etc/nginx/sites-enabled$ cat default server {    listen 80 default_server;     root /data/www/t1;    index index.php index.html  index.htm;    server_name localhost;         Location / {          index  index.htm  index.html index.php;          # The file that accesses the path does not exist and the rewrite URL is forwarded to thinkphp processing          try_files   $uri   /index.php$uri;        }      location ~ .+\.php ($|/)  {           #root         /var/www/html/website;           fastcgi_pass   127.0.0.1:9001;          fastcgi_index   index.php;                      #设置PATH_INFO, note that Fastcgi_split_path_info has automatically rewritten the fastcgi_script_name variable,            #后面不需要再改写SCRIPT_FILENAME, script_name environment variable, so you must set it before loading fastcgi.conf           fastcgi_split_path_info  ^ (. +\.php) (/.*) $;          fastcgi_param  path_info  $fastcgi _path_info;                      #加载Nginx默认 "Server environment variables" configuration            include        fastcgi.conf;      }   }[email protected]:/etc/nginx/sites-enabled$ 


Thankphp project is deployed under Nginx

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.