Nginx + php + mysql (applicable to thinkphp) and nginxthinkphp

Source: Internet
Author: User

Nginx + php + mysql (applicable to thinkphp) and nginxthinkphp

Nginx single-Host Configuration

Http://tengine.taobao.org/book/index.html (taobao book)

Http://ubuntuhandbook.org/index.php/2013/10/install-nginx-php5-mysql-lemp-ubuntu-1310/ (nginx + php5 + mysql)

Http://blog.csdn.net/hursing/article/details/21527159)

: A few command issues:

Sudo apt-get install mysql-server mysql-client

     sudo apt-get install nginx
     sudo apt-get install php5-fpm

: PHP only needs to use php5-fpm

: Configure your own server and directory. thinkphp is supported. The directory is/home/ftp:

Open: sudo vim/etc/nginx/sites-available/default

Server {

Listen 80 default_server;

Listen [:]: 80 default_server defaults 6only = on;

Root/home/ftp;

Index index.html index.htm index. php;

Server_name localhost;

 

Location /{

If (! -E $ request_filename ){

Rewrite ^ (. *) $/index. php? S = $1 last;

Break;

}

}

 

 

Location ~ * \. Php $ {

Fastcgi_pass unix:/var/run/php5-fpm.sock;

Fastcgi_index index. php;

Include fastcgi_params;

 

Set $ path_info "";

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;

 

}

 

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.