修改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
去掉原有的的
server {
}配置
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
character_set_server=utf8
init_connect='SET NAMES utf8'
collation-server=utf8_general_ci
grep 'temporary password' /var/log/MysqLd.log
修改初始密码
alter user root@localhost identified by 'testTest!'
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