Install nginx and php-fpm in yum under centos6.x

Source: Internet
Author: User
Use Nginx official source, Epel extension library and remi source, remi source based on epel, must first install epel source, remi contains php-fpm, mysql-server5.5, if you only need php-fpm, you can install php-fpm separately and disable this source. install Nginx Source: rpm-ivhhttp: // nginx.org/packages/centos/6/noarc

Use Nginx official source, Epel extension library and remi source, remi source based on epel, must first install epel source, remi contains php-fpm, mysql-server5.5, if you only need php-fpm, you can install php-fpm separately and disable this source.
Install Nginx Source:

rpm -ivh http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

Install the EPEL Source:

(64-bit system) rpm-ivh http://download.fedora.redhat.com/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
(32-bit system) rpm-ivh http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm

Install REMI Source:

rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

Enable REMI and edit/etc/yum. repos. d/remi. repo

Modify enable = 1
yum -y install nginx mysql-server  php-fpm php-cli php-pdo php-mysql php-mcrypt php-mbstring php-gd php-tidy php-xml php-xmlrpc php-pear php-pecl-memcache php-eaccelerator
Linux may prompt that libmcrypt. so is not available. the solution is as follows:
rpm -ivh http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm yum clean all yum makecache
yum install libmcrypt
2. set nginx and php-fpm startup: # chkconfig nginx on # chkconfig php-fpm on note: the following error occurs when php-fpm is started by default: starting php-fpm: [28-Nov-2011 08:11:01] ERROR: [pool www] cannot get uid for user 'Apache' solution: # vi/etc/php-fpm.d/www. conf find the following two lines: user = apachegroup = apache, change apache to nginx.
4. enable port 80 (disabled by default): #/sbin/iptables-I INPUT-p tcp -- dport 80-j ACCEPT #/etc/rc. d/init. d/iptables save #/etc/init. d/iptables restart5. modify the nginx configuration file and start nginx and php-fpm: # vi/etc/nginx/conf. d/default. conf changes the root directory of the website and adds the default php file: location/{root/usr/share/nginx/html; index. modify php index.html index.htm;} to the following code and add php Support: # location ~ \. Php $ {# root your/web/path; # fastcgi_pass 127.0.0.1: 9000; # fastcgi_index index. php; # fastcgi_param SCRIPT_FILENAME/your/web/path $ fastcgi_script_name; # include fastcgi_params; #} delete all the above # and one line (root line ), change/your/web/paht to a web storage directory, such as/var/www/html. Start nginx and php-fpm: # service nginx start # service php-fpm start
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.