Baidu has made great achievements, and some articles have said that others are not good at it, but they are also good at it. Please feel the conscience of the industry. Google is still reliable. System environment: Ubuntu13 and Linux
Baidu has made great achievements, and some articles have said that others are not good at it, but they are also good at it. Please feel the conscience of the industry. Google is still reliable.
System environment: Both Ubuntu 13 and Linux Mint 15 pass.
Nginx 1.2.5 and php5.4.9 are installed by default.
First install:
Sudo apt-get install nginx php5-fpm
I passed the test on the newly installed Ubuntu13. it is enough to install only these two things.
Then edit the configuration file.
Sudo gedit/etc/nginx/site-available/default
Note: If you are using gedit instead of vi, you should edit the default file under site-available. if you are editing the default file under site-enabled, because a "default ~" is generated by default when gedit is saved ~" . The insurance practice is to editThe backup files are still manually deleted after files under site-available.
Locate location ~ Where \. php $ is located, five lines of uncomment will become like this:
location ~ \.php$ {#fastcgi_split_path_info ^(.+\.php)(/.+)$;## NOTE: You should have "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;}
This becomes!
Start nginx:
Sudo service nginx start
Extension:
1. in the default file, find
Index index.html;
This line is added
Index index.html index.htm index. php;
You can use the php file as the default homepage.
2. in the default file, add
Autoindex on;
If there is no index file in the folder, the file will be automatically indexed.
3. the root line of the server {} indicator is the root directory of the file. you can modify the folder as the root directory of the website.
Reference: http://ubuntuhandbook.org/index.php/2013/10/install-nginx-php5-mysql-lemp-ubuntu-1310/
Reprinted please indicate the source: http://blog.csdn.net/hursing