Build nginx+php system in Ubuntu environment

Source: Internet
Author: User
Keywords Nginx installation Www lighttpd param
Tags aliyun apt data default environment etc get html

Build nginx+php system in http://www.aliyun.com/zixun/aggregation/13835.html ">ubuntu environment

1, install Nginx, execute the following command, quickly completed, but the current apg-get mode installation default is 0.5.33 version

sudo apt install nginx

Configuration file default installation location:

[Quote]conf:/etc/nginx/nginx.conf

Bin:/usr/sbin/nginx

Vhost:/etc/nginx/sites-enable/default

Cgi-params:/etc/nginx/fastcgi-params[/quote]

Build a virtual server

server {

Listen 80;

server_name www.23day.com;

Access_log/var/log/nginx/home.ucenter.access.log;

Location/{

root/var/www/23day.com;

Index index.php;

Location ~ \.php$ {

Fastcgi_pass 127.0.0.1:9000;

Fastcgi_index index.php;

Fastcgi_param Script_filename/var/www/23day.com$fastcgi_script_name;

Include/etc/nginx/fastcgi_params;

}

}

2, install php-cgi module to perform sudo apt install php5-cgi profile default installation location:

PHP-CGI:/usr/bin/php-cgi

PHP5-CGI:/usr/bin/php5-cgi

CGI config:/usr/bin/cgi/php.ini [/quote]

Modify the php.ini file Cgi.fix_pathinfo data is 1, the default is 0 cgi.fix_pathinfo=1; This allows the php-cgi to normally use the script_filename variable.

3, the installation of spawn-fcgi spawn-fcgi is a lighttpd tool to control php-cgi.

If the system does not have the GCC compilation environment installed, just need to install the Build-essential Toolkit before installing LIGHTTPD, and execute the following command

sudo apt install build-essential

wget http://www.lighttpd.net/download/lighttpd-1.4.19.tar.gz

TAR-XVF lighttpd-1.4.19.tar.gz

CD lighttpd-1.4.19/

sudo apt install Libpcre3-dev

./configure–without-zlib–without-bzip2

Make

sudo cp src/spawn-fcgi/usr/local/bin/spawn-fcgi

This allows the CGI controller to be installed.

4. Start the test system. FAST_CGI:

Spawn-fcgi-a 127.0.0.1-p 9000-c 5-u www-data-g www-data-f

Note: IP, the port corresponds to the Cgi-pass in the Nginx server. -C means to open several CGI processes

Start Nginx

Sudo/etc/init.d/nginx start

Well, if there is no error message, then the configuration is successful, now write a phpinfo test!

Related Article

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.