Install the Nginx after installing PHP and PHP-FPM.

Source: Internet
Author: User
Install PHP5-FPM, php5-cgi. and install other PHP components according to your needs

sudo apt-get install Nginx php5-fpm
sudo apt-get install PHP-APC php5-curl php5-gd php5-imagick php5-mysql php5-memcache php5-memcached php5- MCrypt

Configure Nginx

sudo vi/etc/nginx/sites-available/default

Code

server {
Listen 80; # # Listen for IPv4
Listen [::]: Default ipv6only = on; # # Listen for IPv6

server_name localhost;

root/var/www;

Index index.php index.html index.htm;

Expires 14d;

#access_log/var/log/nginx/localhost.access.log;

Location ~ \.php$ {
Fastcgi_pass 127.0. 0.1:9,000;
Fastcgi_index index.php;
Fastcgi_param application_env production;
Include fcgi.conf;

Expires off;
}
}

Modify Fastcgi.conf

Code

Fastcgi_param Gateway_interface cgi/1.1;
Fastcgi_param Server_software Nginx;

Fastcgi_param query_string $query _string;
Fastcgi_param Request_method $request _method;
Fastcgi_param Content_Type $content _type;
Fastcgi_param content_length $content _length;

Fastcgi_param script_filename $document _root$fastcgi_script_name;
Fastcgi_param script_name $fastcgi _script_name;
Fastcgi_param Request_uri $request _uri;
Fastcgi_param Document_uri $document _uri;
Fastcgi_param document_root $document _root;
Fastcgi_param server_protocol $server _protocol;

Fastcgi_param remote_addr $remote _addr;
Fastcgi_param Remote_port $remote _port;
Fastcgi_param server_addr $server _addr;
Fastcgi_param server_port $server _port;
Fastcgi_param server_name $server _name;

# PHP only, required if PHP is built with? enable-force-cgi-redirect
Fastcgi_param Redirect_status 200;

Modify nginx.conf when modifying the Web default directory in order to/var/www/, you can build a PHP test page in this directory

Access

Reference: http://shen2.cn/2010/08/nginx-php5-fpm/

  • 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.