Centos is the easiest way to install nginx + MySQL + PHP + FastCGI + memcache

Source: Internet
Author: User
Tags apc openldap

I. Update yum

Yum-y update

Ii. Use Yum to upgrade variousProgramLibrary

1. lang = C

2. yum-y install GCC gcc-C ++ Autoconf libjpeg-devel libpng-devel FreeType-devel libxml2 libxml2-devel zlib-devel glibc-devel glib2 glib2-devel Bzip2 bzip2-devel ncurses- devel curl-devel e2fsprogs e2fsprogs-devel krb5 krb5-devel libidn-devel OpenSSL-devel OpenLDAP openldap-devel nss_ldap openldap-clients openldap-servers

3. Install nginx
Because centos does not have the default nginx package, you need to enable the rehl attachment package.

1. rpm-uv h http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

2. Yum-y install nginx
Set startup
Chkconfig nginx on

Nginx: http://www.uusnn.com.cn /? Attachment_id=81( .rar)

Configure nginx
The nginx. conf configuration file is as follows:

User nginx;
Worker_processes 1;
Error_log/var/log/nginx/error. log;
Pid/var/run/nginx. PID;
Events {
Worker_connections 1024;
}
HTTP {
Include/etc/nginx/mime. types;
Default_type application/octet-stream;

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

Sendfile on;
# Tcp_nopush on;

# Keepalive_timeout 0;
Keepalive_timeout 65;

Gzip on;

# Load config files from the/etc/nginx/CONF. d directory
Include/etc/nginx/CONF. d/*. conf;

Server {
Listen 80;
SERVER_NAME _;

Root/usr/share/nginx/html;
Include common_www;
}

}
The common_www file is as follows:

Index index.html index.htm;

Error_page 404/404 .html;
Location =/404.html {
Root/usr/share/nginx/html;
}

Error_page 500 502 503 x.html;
Location =/50x.html {
Root/usr/share/nginx/html;
}

Location ~ \. Php $ {
Root HTML;
Fastcgi_pass 127.0.0.1: 9000;
Fastcgi_index index. php;
Fastcgi_param script_filename $ document_root $ fastcgi_script_name;
Include fastcgi_params;
}

Location ~ /\. Ht {
Deny all;
}

4. install PHP and memcache
Yum-y install PHP-cli PHP-pdo php-mcrypt PHP-mbstring PHP-json php-FastCGI PHP-cgi php-Gd PHP-tidy PHP-xml php-xmlrpc php-Pear php-PECL-memcache PHP-eaccelerator
# APC conflicts with eaccelerator. Select 2 and select 1.
Yum-y install PHP-PECL-APC

5. Install spawn-fcgi to run php-CGI

Yum install spawn-fcgi

6. Download the startup script of spawn-fcgi
Wget http://bash.cyberciti.biz/dl/419.sh.zip
Unzip 419.sh.zip
MV 419.sh/etc/init. d/php_cgi
Chmod + x/etc/init. d/php_cgi

Start php_cgi

/Etc/init. d/php_cgi start

View Processes

Netstat-tulpn | grep: 9000

If the following occurs, everything is normal.

TCP 0 0 127.0.0.1: 9000 0.0.0.0: * Listen 4352/PHP-CGI

: 419.sh.zip

Http://www.uusnn.com.cn /? Attachment_id = 80

VII.,Install MySQL
Yum-y install mysql-Server Plugin install MySQL
Yum-y install PHP-mysql plugin install PHP-MySQL

VI/etc/My. CNF
Add in [mysqld]
Default-character-set = UTF

Add the following chapters at the end

[MySQL]
Default-character-set = utf8

Start MySQL

Chkconfig mysqld on startup

Chkconfig-list mysqld restart confirm that MySQL is automatically started
Mysqld 0: off 1: off 2: On 3: On 4: On 5: on 6: off done if 2-5 is on OK
/Etc/rc. d/init. d/mysqld start slave start MySQL Service

Set initial password

Mysqladmin-u Root Password 123456

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.