Home » Linux » Centos7 安装Nginx+PHP5.4+Mysql5.7

rpm -qa | grep mysql
rpm -qa |grep mariadb

-

yum remove mysql***
yum remove mariadb***

-

cd /opt
mkdir mysql
cd mysql

Mysql直接下载阿里云,手动安装

wget https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/mysql-community-server-5.7.31-1.el7.x86_64.rpm
wget https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/mysql-community-client-5.7.31-1.el7.x86_64.rpm
wget https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/mysql-community-common-5.7.31-1.el7.x86_64.rpm
wget https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/mysql-community-libs-5.7.31-1.el7.x86_64.rpm
wget https://mirrors.huaweicloud.com/mysql/Downloads/MySQL-5.7/mysql-community-libs-compat-5.7.31-1.el7.x86_64.rpm

-

yun install net-tools
yum install libaio
yum install perl

-

rpm -ivh mysql-community-common-5.7.31-1.el7.x86_64.rpm 
rpm -ivh mysql-community-libs-5.7.31-1.el7.x86_64.rpm 
rpm -ivh mysql-community-client-5.7.31-1.el7.x86_64.rpm
rpm -ivh mysql-community-server-5.7.31-1.el7.x86_64.rpm 

-

systemctl start mysqld

-

grep 'temporary password' /var/log/mysqld.log //找初始密码

-

mysql_secure_installation //mysql初始化

-

yum install php php-mysql php-fpm

-
vi /etc/php.ini

;cgi.fix_pathinfo=1 改为 cgi.fix_pathinfo=0

vi /etc/php-fpm.d/www.conf

user = nginx
group = nginx

systemctl start php-fpm
systemctl enable php-fpm

-

yum install nginx

vi /etc/nginx/nginx.conf

 server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;
        //增加下面一行
        index index.php index.html index.htm;
        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;
        location / {
        }
        error_page 404 /404.html;
            location = /40x.html {
        }
        error_page 500 502 503 504 /50x.html;
            location = /50x.html {
        }
        //增加
        location ~ .php$ {
        try_files $uri =404;
        root /usr/share/nginx/html;
        fastcgi_pass 127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include fastcgi.conf;
        //增加
    }
    }

-

systemctl restart nginx

标签: centos MySQL PHP Nginx

添加新评论

V