mysql yum 57_centos 7 yum命令安装 Nginx、PHP 7、MySQL 57 、redis

修改yum源

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

rpm -Uvh https://mirror.webtatic.com/yum/el7/webtatic-release.rpm

rpm -Uvh  http://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

安装nginx

yum -y install nginx

安装php

yum -y install php70w-devel php70w.x86_64 php70w-pecl-redis  php70w-cli.x86_64 php70w-common.x86_64 php70w-gd.x86_64 php70w-ldap.x86_64 php70w-mbstring.x86_64 php70w-mcrypt.x86_64  php70w-pdo.x86_64   php70w-mysqlnd  php70w-fpm php70w-opcache

安装mysql

yum -y install mysql-community-server

安装redis

yum -y install redis

修改nginx配置文件

vi etc/nginx/nginx.conf

去掉原有的的

server {

}配置

新建nginx配置文件

vi /etc/nginx/conf.d/user.conf

server {

listen       80;#端口

server_name admin.com  www.admin.com; # 域名

root /home/www/web/newomcat/admin; # 网站根目录

index index.php index.html index.htm;#默认的index

# 建议放内网

# allow 192.168.0.0/24;

# deny all;

location / {

if (!-e $request_filename) {

rewrite ^/(.*)$ /index.php?$1 last;#去除url中的index.php 不需要可以不写

}

}

location ~ \.php$ {

try_files $uri = 404;

fastcgi_pass   127.0.0.1:9000;

fastcgi_index  index.php;

fastcgi_param  SCRIPT_FILENAME  $document_root$fastcgi_script_name;

include        fastcgi_params;

}

}

mysql 配置

vi /etc/my.cnf

在[client] 下面添加

default-character-set=utf8

在 [mysqld] 下面添加

character_set_server=utf8

init_connect='SET NAMES utf8'

collation-server=utf8_general_ci

获取mysql初始密码

grep 'temporary password' /var/log/mysqld.log

修改初始密码

alter user root@localhost identified by 'testTest!'

添加一个可以在外部登陆的mysql用户

grant all privileges on *.* to 创建的用户名 @"%" identified by "密码";

相关的启动命令

systemctl restart php-fpm   #启动php

systemctl restart nginx #启动nginx

systemctl restart  mysqld #启动mysql

sudo redis-server /etc/redis.conf #启动redis

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值