«

安装nginx和php

时间:2022-11-21 11:22     作者:六度科技     分类: linux技巧


安装nginx

yum install yum-priorities -y

wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm

rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm

yum install nginx -y

systemctl start nginx.service #启动nginx

systemctl stop nginx.service #停止

systemctl restart nginx.service #重启

systemctl enable nginx.service #设置开机启动

/etc/nginx/nginx.conf //yum方式安装后默认配置文件的路径

/usr/share/nginx/html //nginx网站默认存放目录

/usr/share/nginx/html/index.html //网站默认主页路径

【安装php】
***可以借鉴这个地址
yum安装PHP http://t.zoukankan.com/mrjiang-test-p-13407194.html

1、首先要更新yum源,不然是默认的老版本,一般都在5.6及以下,但是php7都出来好久了,性能提升50%以上!

按照系统更新yum源,我的是centos7,所以我运行下面的代码!

CentOS/RHEL 7.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpmrpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

如果是centos6,那么执行以下代码:

CentOS/RHEL 6.x:

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpmrpm -Uvh https://mirror.webtatic.com/yum/el6/latest.rpm

然后就可以直接yum安装php7.0了,可以安装的拓展如下:

yum install php70w-common php70w-fpm php70w-opcache php70w-gd php70w-mysqlnd php70w-mbstring php70w-pecl-redis php70w-pecl-memcached php70w-devel

就这一条命令,就可以安装了下面的拓展了!

php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml, php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib

激动吧?别急,还有更牛的!一般都要安装memcached,gd,mysql,等等是吧?

1 安装包 提供的拓展 2 php70w mod_php , php70w-zts 3 php70w-bcmath

4 php70w-cli php-cgi, php-pcntl, php-readline 5 php70w-common php-api, php-bz2, php-calendar, php-ctype, php-curl, php-date, php-exif, php-fileinfo, php-filter, php-ftp, php-gettext, php-gmp, php-hash, php-iconv, php-json, php-libxml, php-openssl, php-pcre, php-pecl-Fileinfo, php-pecl-phar, php-pecl-zip, php-reflection, php-session, php-shmop, php-simplexml , php-sockets, php-spl, php-tokenizer, php-zend-abi, php-zip, php-zlib 6 php70w-dba

7 php70w-devel

8 php70w-embedded php-embedded-devel 9 php70w-enchant

10 php70w-fpm

11 php70w-gd

12 php70w-imap

13 php70w-interbase php_database, php-firebird14 php70w-intl

15 php70w-ldap

16 php70w-mbstring

17 php70w-mcrypt

18 php70w-mysql php-mysqli, php_database19 php70w-mysqlnd php-mysqli, php_database20 php70w-odbc php-pdo_odbc, php_database21 php70w-opcache php70w-pecl-zendopcache22 php70w-pdo php70w-pdo_sqlite, php70w-sqlite323 php70w-pdo_dblib php70w-mssql24 php70w-pear

25 php70w-pecl-apcu

26 php70w-pecl-imagick

27 php70w-pecl-memcached

28 php70w-pecl-mongodb

29 php70w-pecl-redis

30 php70w-pecl-xdebug

31 php70w-pgsql php-pdo_pgsql, php_database32 php70w-phpdbg

33 php70w-process php-posix, php-sysvmsg, php-sysvsem, php-sysvshm34 php70w-pspell

35 php70w-recode

36 php70w-snmp

37 php70w-soap

38 php70w-tidy

39 php70w-xml php-dom, php-domxml, php-wddx, php-xsl40 php70w-xmlrpc

譬如你要加装xml,那么可以直接,别怀疑就是这么简单:

yum install php70w-xml

2、检验一下成果:

查看一下php版本:

php -v