centos 7 yum命令安裝 Nginx、PHP 7、MySQL 57 、redis 、編譯安裝swoole

增加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

去掉一下的設(shè)置

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; # 網(wǎng)站根目錄

index index.php index.html index.htm;#默認(rèn)的index

# 建議放內(nèi)網(wǎng)

# 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

//設(shè)置初始密碼

SET PASSWORD = PASSWORD('123456');大寫字母+數(shù)字+特殊字符混合了一個(gè)密碼

修改初始密碼

alter user root@localhost identified by 'tyzZ001!'

添加一個(gè)可以在外部登陸的mysql用戶

grant all privileges on *.* to 創(chuàng)建的用戶名 @"%" identified by "密碼";

相關(guān)的啟動(dòng)命令

systemctl restart php-fpm? #啟動(dòng)php

systemctl restart nginx #啟動(dòng)nginx

systemctl restart? mysqld #啟動(dòng)mysql

sudo redis-server /etc/redis.conf #啟動(dòng)redis

安裝swoole

安裝編輯軟件

yum install gcc-c++ openssl-devel

git獲取swoole安裝包

git clone https://github.com/swoole/swoole-src.git

進(jìn)行編輯安裝

cd swoole-src

phpize

./configure

make && make install

修改php.ini配置文件

vim /etc/php.ini

增加

extension=swoole.so

查看是否安裝swoole

php -m

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

推薦閱讀更多精彩內(nèi)容