The simplest way to build Ubuntu + Nginx + PHP

Source: Internet
Author: User
Tags linux mint
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

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.