多语言展示
当前在线:1956今日阅读:165今日分享:48

使用yum快速安装nginx、php

php和nginx都能使用yum来快速安装,只不过需要安装第三方的epel源,而不能使用系统自带的yum源
工具/原料
1

epel

2

centos7.2_x64

方法/步骤
1

安装yum源yum install epel-release

2

安装phpyum 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 phpphp-fpm.service                               disabled[root@remote ~]# systemctl start php-fpm.service[root@remote ~]# ps -ef|grep phproot     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 wwwapache   37833 37830  0 23:36 ?        00:00:00 php-fpm: pool wwwapache   37834 37830  0 23:36 ?        00:00:00 php-fpm: pool wwwapache   37835 37830  0 23:36 ?        00:00:00 php-fpm: pool wwwapache   37836 37830  0 23:36 ?        00:00:00 php-fpm: pool wwwroot     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.rpmrpm -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 nginxnginx.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 nginxroot     39589     1  0 23:44 ?        00:00:00 nginx: master process /usr/sbin/nginxnginx    39590 39589  0 23:44 ?        00:00:00 nginx: worker processroot     39651 37526  0 23:45 pts/2    00:00:00 grep --color=auto nginx

推荐信息