Build Nginx+php+mysql Environment under CentOS

Source: Internet
Author: User
Tags install php openssl php and mysql php mysql openldap

Before a cloud host to play, installed a CentOS, and then set up a nginx+php+mysql environment, in accordance with the various tutorials on the Internet installed or encountered a little problem, so I did the installation process, and then record the cost of the article.

1. Installing CentOS

Well, I chose this. IDC provides several operating system options, including CentOS, cloud host backend mouse Click OK, and then SSH connected to the installation of other software.

2. Install the required library files and the compilation environment

Yum Install GCC gcc-c++ autoconf libjpeg libjpeg-devel libpng libpng-devel freetype Freetype-devel Libxml2 Libxml2-devel Zlib ZL Ib-devel glibc glibc-devel glib2  bzip2bzip2-devel ncurses ncurses-devel Curl Curl-devel E2fsprogs e2fsprogs-devel krb5 krb5-devel libidn libidn-devel OpenSSL openssl-devel openldap  openldap-devel Nss_ LDAP openldap-clients Openldap-servers

3. Install PHP and MySQL

Yum install php mysql mysql-server mysql-devel php-mysql php-cgi php-mbstring php-gd php-fastcgi

To set up MySQL startup

Service mysqld start        // start MySQL service chkconfig mysqld on      // set boot auto start

Set up PHP start-up

PHP runs php-cgi,spawn-fcgi by installing spawn-fcgi to invoke PHP to provide a dynamic PHP format for Web pages

 wget  http:// www.lighttpd.net/download/spawn-fcgi-1.6.3.tar.bz2  tar  xvf spawn-fcgi-3 . tar  .BZ2CD spawn -fcgi-3   /configure--prefix=/usr/local/spawn-fcgi   Make  make  install  ln -s/usr/local/spawn-fcgi/bin/spawn-fcgi/usr/bin/
wget http://bash.cyberciti.biz/dl/419.sh.zip  //This is a script written by someone else, take it directly with unzip 419.SH.ZIPMV 419.sh/etc/init.d/Php_ Cgichmod +x/etc/init.d/php_cgi/etc/init.d/php_cgi start    //start php_cgi 

It is important to note that if wget is executed, wget command not found is required to install wget first.

Yum Install wget

4. Installing Nginx

Since CentOS does not have a default Nginx package, you need to enable the Rehl attachment pack

RPM-UVH http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm

Yum-y Install Nginx

Chkconfig Nginx on//Set boot up

Service Nginx Start//start Ngin Services

If the installation error, you can use the following replacement package

RPM-IVH http://nginx.org/packages/centos/6/noarch/rpms/nginx-release-centos-6-0.el6.ngx.noarch.rpm 

After installing the Nginx, you can set the site, nginx default site configuration file in/etc/nginx this directory.

Build Nginx+php+mysql Environment under CentOS

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.