使用yum快速安装nginx、php
1、安装yum源
yum install epel-release
2、安装php
yum install php-fpm php-cli php-mysql php-gd php-imap php-ldap php-odbc php-pear php-xml php-xmlrpc php-magickwand php-magpierss php-mbstring php-mcrypt php-mssql php-shout php-snmp php-soap php-tidy
清除、生成cache和安装是一个漫长的过程
3、先找到php服务然后启动它
[root@remote ~]# systemctl list-unit-files|grep php
php-fpm.service disabled
[root@remote ~]# systemctl start php-fpm.service
[root@remote ~]# ps -ef|grep php
root 37830 1 1 23:36 ? 00:00:00 php-fpm: master process (/etc/php-fpm.conf)
apache 37832 37830 0 23:36 ? 00:00:00 php-fpm: pool www
apache 37833 37830 0 23:36 ? 00:00:00 php-fpm: pool www
apache 37834 37830 0 23:36 ? 00:00:00 php-fpm: pool www
apache 37835 37830 0 23:36 ? 00:00:00 php-fpm: pool www
apache 37836 37830 0 23:36 ? 00:00:00 php-fpm: pool www
root 37865 37526 0 23:36 pts/2 00:00:00 grep --color=auto php
4、设置php-fpm随系统自动启动
systemctl enable php-fpm.service
5、安装nginx需要先下载nginx的源并安装
wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm
rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm
安装完nginx源之后再使用yum install nginx命令安装
6、启动nginx并设置nginx随系统自动启动
[root@remote src]# systemctl list-unit-files|grep nginx
nginx.service disabled
[root@remote src]# systemctl start nginx.service
[root@remote src]# systemctl enable nginx.service
Created symlink from /etc/systemd/system/multi-user.target.wants/nginx.service to /usr/lib/systemd/system/nginx.service.
[root@remote src]# ps -ef|grep nginx
root 39589 1 0 23:44 ? 00:00:00 nginx: master process /usr/sbin/nginx
nginx 39590 39589 0 23:44 ? 00:00:00 nginx: worker process
root 39651 37526 0 23:45 pts/2 00:00:00 grep --color=auto nginx