CentOS 7 yum安装 Nginx
下载nginx yum源
wget http://nginx.org/packages/centos/7/noarch/RPMS/nginx-release-centos-7-0.el7.ngx.noarch.rpm
添加repo
rpm -ivh nginx-release-centos-7-0.el7.ngx.noarch.rpm //得到yum源文件nginx.repo
显示结果 yum list | grep nginx
nginx-release-centos.noarch 6-0.el6.ngx installed
nginx.x86_64 1.16.0-1.el6.ngx nginx
nginx-debug.x86_64 1.8.0-1.el6.ngx nginx
nginx-debuginfo.x86_64 1.16.0-1.el6.ngx nginx
nginx-module-geoip.x86_64 1.16.0-1.el6.ngx nginx
nginx-module-geoip-debuginfo.x86_64 1.16.0-1.el6.ngx nginx
nginx-module-image-filter.x86_64 1.16.0-1.el6.ngx nginx
nginx-module-image-filter-debuginfo.x86_64 1.16.0-1.el6.ngx nginx
nginx-module-njs.x86_64 1.16.0.0.3.2-1.el6.ngx nginx
nginx-module-njs-debuginfo.x86_64 1.16.0.0.3.2-1.el6.ngx nginx
nginx-module-perl.x86_64 1.16.0-1.el6.ngx nginx
nginx-module-perl-debuginfo.x86_64 1.16.0-1.el6.ngx nginx
nginx-module-xslt.x86_64 1.16.0-1.el6.ngx nginx
nginx-module-xslt-debuginfo.x86_64 1.16.0-1.el6.ngx nginx
nginx-nr-agent.noarch 2.0.0-12.el6.ngx nginx
pcp-pmda-nginx.x86_64 3.10.9-9.el6 base
安装nginx
yum install nginx.x86_64
启动,开机自启动
//启动
systemctl start nginx.service
//设置开机自启动:
systemctl enable nginx.service
//查看服务当前状态
systemctl status nginx.service
//关闭防火墙
systemctl stop firewalld.service //停止firewall
systemctl disable firewalld.service //禁止firewall开机启动
systemctl list-units --type=service //查看所有已启动的服务
Nginx 配置 php
server {
listen 80;
server_name localhost;
root /www/video; #放在外面
index index.php;
charset utf-8;
error_log /root/nginx.error.log error;
access_log /root/nginx.access.log main;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$; #开启path_info
fastcgi_param PATH_INFO $fastcgi_path_info; #开启path_info
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
include /etc/nginx/maccms.conf; #开启伪静态
}
CentOS 7 下yum安装 MySQL5.5
检查是否安装过
1. rpm -qa|grep mysql 是否安装过mysql5.1有就卸载.
2. 卸载命令:rpm -e mysql-libs --nodeps
添加repo
//下载
wget https://dev.mysql.com/get/mysql57-community-release-el7-11.noarch.rpm
//添加
rpm -Uvh mysql57-community-release-el7-11.noarch.rpm
查看当前可安装版本
yum repolist all | grep mysql
修改安装版本
//关闭5.7版本安装
yum-config-manager --disable mysql57-community
//打开55版本安装
yum-config-manager --enable mysql55-community
yum-config-manager 无法执行,这个是因为系统默认没有安装这个命令,这个命令在yum-utils 包里,可以通过命令yum -y install yum-utils 安装就可以了
验证版本
yum repolist all | grep mysql
//或者
yum repolist enabled | grep mysql
查看当前 enabled 的 mysql 版本,如果是你设置的版本。就可以安装了。
安装MySQL5.5
yum install mysql-community-server
启动MySQL
systemctl start mysqld.service
开机自启动
systemctl enable mysqld.service
启用MySQL安全设置
set password for 'root'@'localhost' = PASSWORD('newpassword');
验证一下MySQL是否安装成功
mysql -uroot -p12345
配置my.ini
vi /etc/my.cnf
Centos 7 yum安装php5.6
检查当前安装的PHP包
yum list installed | grep php
如果有安装的PHP包,先删除他们
yum remove php.x86_64 php-cli.x86_64 php-common.x86_64 php-gd.x86_64 php-ldap.x86_64 php-mbstring.x86_64 php-mcrypt.x86_64 php-mysql.x86_64 php-pdo.x86_64
配置yum源
//以下是CentOS 7.0的源。
yum install epel-release
rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
使用yum list命令查看可安装的包(Packege)。
yum list --enablerepo=remi --enablerepo=remi-php56 | grep php
安装PHP5.6.x
yum install --enablerepo=remi --enablerepo=remi-php56 php php-opcache php-devel php-mbstring php-mcrypt php-mysqlnd php-phpunit-PHPUnit php-pecl-xdebug php-pecl-xhprof php-gd php-redis
安装PHP-fpm
yum install --enablerepo=remi --enablerepo=remi-php56 php-fpm
安装GD库
yum --enablerepo=remi-php56 install php-gd
启动php服务
systemctl start php-fpm
设置php服务开机自启动
systemctl enable php-fpm
作者:fangjunai