Nginx+php+mysql installation configuration under Ubuntu

Source: Internet
Author: User

1, update

sudo apt-get update

2. Installation Nginx

sudo apt-get intsall nginx

After Ubuntu installation, the file structure is roughly:

* All configuration files are under/etc/nginx, and each virtual host has been placed under/etc/nginx/sites-available

* Program Files in the/usr/sbin/nginx * log in the/var/log/nginx

* and a startup script has been created under/etc/init.d/nginx

* The default virtual host directory is set to/var/www/nginx-default

The following can start Nginx to see the effect (please make sure that 80 ports are not using any other service):

Sudo/etc/init.d/nginx start

#或者简单的

Service Nginx Start

Then open the browser and check http://localhost/to see if the "Welcome to nginx!" is seen, indicating that the installation was successful.

Of course, basically, this piece of the child will not be a problem. If the operation is unsuccessful, you can first

sudo killall apache2

Kill the Apache Process

3. Install PHP

sudo apt-get install php5 php5-cgi php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5 -memcache php5-mhash php5-ming Php5-pspell php5-recode php5-snmp php5-tidy php5-xmlrpc php5-sqlite php5-xsl

4. Installation spawn-fcgi

Why install spawn-fcgi, which is used to control php-cgi processes to prevent process crashes or inefficient single processes.

Many people on the internet have said that to use spawn-fcgi must have to install LIGHTTPD, actually not necessary, can be directly installed spawn-fcgi

Run:

sudo apt-get install spawn-fcgi

5, configuration

The next is the most annoying configuration.

Configure Nginx and spawn-fcgi to run together

(). At the end of the/etc/nginx/fastcgi_params file, add a line that you can use

sudo vi/etc/nginx/fastcgi_params

Join this row:

Fastcgi_param Script_filename Documentrootfastcgi_script_name;

(2). In addition, you need to find the Cgi.fix_pathinfo option in the php-cgi configuration file (this profile is located in/etc/php5/cgi/php.ini on Ubuntu), and modify it to:

cgi.fix_pathinfo=;

This allows the php-cgi to normally use the script_filename variable.

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.