Recently took over and maintained a Linux server, Centos6 version, the customer wants to convert from Apache to Nginx. Upgrade PHP to the latest version at the same time
Configure Nginx1.0.10+PHP5.3.8(fastcgi)+Mysql5.5.17+eAccelerator as follows (the relevant version number is the latest version of the source software package)
Use Nginx official source, Epel extension library and remi source, remi source is based on epel, you must install epel source first, remi contains php-fpm, mysql-server5.5, if you only need php-fpm, you can use it separately Disable this source after installing php-fpm.
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 the REMI sources:
rpm -ivh
http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
Open REMI, edit /etc/yum.repos.d/remi.repo
vi /etc/yum.repos.d/remi.repo
Modify enable=1
esc
:wq
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
1. Configure the nginx configuration file according to the requirements (this blog post does not provide specific configuration)
2. Modify /etc/php-fpm.conf user group to nginx
3. Modify /var/lib/php/session (so that php can save the session), and the web user group is nginx
chown -R nginx:nginx /var/lib/php/session (you need to create if it does not exist)
chown -R nginx:nginx /var/www/ (web directory)
chmod -R 775 /var/www/
(Permissions can be modified in the same group to facilitate ftp configuration. ftp should be added to the nginx group. If higher security settings are required, read-only directories should not be given writable permissions to nginx and php groups)
service nginx start(start|stop|restart|reload)
service php-fpm start(start|stop|restart)
service mysqld start(start|stop|restart|reload)
set autostart
chkconfig nginx on
chkconfig php-fpm on
chkconfig mysqld on