have been groping, Baidu a lot of articles, to arrive at the simplest installation method, but do not know whether it is correct, or what is missing.
1. Installing Nginx
sudo apt-get install Nginx
2. Install PHP
sudo apt-get install PHP5-FPM
3. Configure Nginx
sudo gedit/etc/nginx/sites-available/default
root/www;
Index index.html index.htm index.php;
Location ~ \.php$ {
Fastcgi_pass Unix:/var/run/php5-fpm.sock;
Include Fastcgi_params;
}
4. Start Nginx
sudo service nginx start
Installation is complete, now there are two problems, many articles on the internet are similar, the main difference in PHP installation and Nginx configuration where.
1.php only need to install PHP5-FPM?
2. Location ~ \.php$ {
# Fastcgi_split_path_info ^ (. +\.php) (/.+) $;
# # Note:you should has "cgi.fix_pathinfo = 0;" In php.ini
#
# # with php5-cgi alone:
# Fastcgi_pass 127.0.0.1:9000;
# with PHP5-FPM:
Fastcgi_pass Unix:/var/run/php5-fpm.sock;
# Fastcgi_index index.php;
Include Fastcgi_params;
}
What does the configuration of each line mean?
3. Why do I use Fastcgi_pass 127.0.0.1:9000 to start nginx?
Reply to discussion (solution)
No, come and have a look.
Recommend that code be posted for analysis
First of all, I built, you use Centsos? PHP, he is more than Ubuntu? You can search for CentOS's history.
sudo apt-get install Nginx
What is sudo? Limit apt-get install is direct Ubuntu? like to get Ann Bao Ann?
The command in CentOS is yum install Nginx
Build PHP on Linux? I'm building it. Lnmp??? The??? After the close of the boundary, then again? What is the quality of the nginx? and fastcgi? A part of it is very hemp and important, and there are fixed placement methods available for you to test, a lot of Yi to yourself?? Groping, because? The hardware and performance of each server is different, if it is not good, your station? Often out of??? 500 or?? 502