# sed -i 's/^\=enforcing/SELINUX=disabled/' /etc/selinux/config
立即生效
# setenforce 0
# iptables -F
# iptables -X
# systemctl stop firewalld
# systemctl disable firewalld
载入公钥和yum源
# rpm --import https://www.elrepo.org/RPM-GPG-KEY-elrepo.org
# rpm -Uvh http://www.elrepo.org/elrepo-release-7.0-3.el7.elrepo.noarch.rpm
# yum install -y yum-plugin-fastestmirror
# yum --enablerepo=elrepo-kernel install kernel-ml kernel-ml-devel -y
将kernel-ml 选为第一启动
# grub2-set-default 0
# reboot
重启后,通过 uname -a 查看内核是否切换到最新版
# echo "net.core.default_qdisc=fq" >> /etc/sysctl.conf
# echo "net.ipv4.tcp_congestion_control=bbr" >> /etc/sysctl.conf
# sysctl -p 保存配置文件
开启BBR
# sysctl net.ipv4.tcp_available_congestion_control
# sysctl net.ipv4.tcp_congestion_control
查看是否开启了bbr
# lsmod | grep bbr
tcp_bbr 20480 6
# rpm -Uvh http://nginx.org/packages/centos/7/x86_64/RPMS/nginx-1.16.0-1.el7.ngx.x86_64.rpm
# yum install -y nginx
启动 nginx
# systemctl enable nginx
# nginx
# 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
# yum -y install php72w-fpm
# echo 'export LC_ALL=C' > /etc/profile
# source /etc/profile
替换 apache 组和用户为 nginx
# sed -i 's/^\ = apache*/user = nginx/' /etc/php-fpm.d/www.conf
# sed -i 's/^\ = apache*/group = nginx/' /etc/php-fpm.d/www.conf
# yum -y install php72w-common php72w-cli php72w-opcache php72w-bcmath php72w-dba php72w-devel php72w-embedded php72w-enchant php72w-gd php72w-imap php72w-interbase php72w-intl php72w-ldap php72w-mbstring php72w-mcrypt php72w-mysql php72w-mysqlnd php72w-odbc php72w-pdo php72w-pdo_dblib php72w-pear php72w-pecl-apcu php72w-pecl-imagick php72w-pecl-memcached php72w-pecl-mongodb php72w-pecl-redis php72w-pecl-xdebug php72w-pgsql php72w-phpdbg php72w-process php72w-pspell php72w-recode php72w-snmp php72w-soap php72w-tidy php72w-xml php72w-xmlrpc --skip-broken
启动php
# systemctl enable php-fpm
# systemctl start php-fpm
# yum install -y http://rpms.famillecollet.com/enterprise/remi-release-7.rpm
# yum -y --enablerepo=remi install redis
# systemctl start redis
# systemctl enable redis.service
# yum localinstall http://dev.mysql.com/get/mysql57-community-release-el7-7.noarch.rpm -y
# yum install mysql-community-server -y
# yum install mysql-community-devel -y
启动数据库
# systemctl enable mysqld
# systemctl start mysqld
初始化前密码在此路径下
grep 'temporary password' /var/log/mysqld.log
修改 mysql root 密码
ALTER USER 'root'@'localhost' IDENTIFIED BY '123456';
授权用户登录
GRANT ALL PRIVILEGES ON *.* TO 'user'@'%' IDENTIFIED BY '123456' WITH GRANT OPTION;
vim /etc/nginx/conf.d/www.conf
server {
listen 80;
server_name localhost;
index index.html index.htm index.php;
root /var/www/html/;
#add_header 'Access-Control-Allow-Origin' '*';
#add_header 'Access-Control-Allow-Headers' 'X-Requested-With,content-type,app_type,sign,did,time';
#add_header 'Access-Control-Allow-Methods' 'GET,POST,PUT,DELETE,OPTIONS';
location ~ \.php($|/) {
fastcgi_pass 127.0.0.1:9000;
fastcgi_read_timeout 300;
fastcgi_index index.php;
fastcgi_split_path_info ^(.+\.php)(.*)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
include fastcgi_params;
}
location / {
# if ($request_method = 'OPTIONS') {
#return 204;
# }
# add_header 'Access-Control-Allow-Origin' '*';
# add_header 'Access-Control-Allow-Methods' 'GET,POST,OPTIONS';
try_files $uri $uri/ /index.php$is_args$query_string;
if (!-e $request_filename) {
rewrite ^(.*)$ /index.php?s=$1 last;
break;
}
}
access_log off;
}
重启 Nginx
nginx -s reload
vim /etc/redis.conf
......
bind 0.0.0.0 允许所有地址登录
loglevel verbose 设置日志类型
requirepass 123456 设置密码
......
重启redis
service redis restart
vim /var/www/html/index.html
访问本地IP测试,如果出现php的界面,就证明php环境没有问题