Centos7.6 build LNMP environment

Preface

The system is centos7.6 nginx is 1.12 php is 7.2 MySQL is 8.0.16

nginx service##

  1. Installation dependencies
    sudo yum install -y yum-utils
  2. Install nginx service
    sudo yum install -y nginx
  3. Configure nginx to support php
    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_rootfastcgi_script_name; include fastcgi.conf;} the fifth line It is your web directory, my (centos7.6+nginx1.12) environment defaults to the location of usr/share/nginx/html

Install php environment##

  1. If you have installed the php service before, please uninstall it first
    yum -y remove php*

  2. Since the yum source of linux does not exist in php7.x, we have to change the yum source
    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

  3. Install php72w and various extensions, just choose what you need
    yum -y install php72w php72w-cli php72w-common php72w-devel php72w-embedded php72w-fpm php72w-gd php72w-mbstring php72w-mysqlnd php72w-opcache php72w-pdo php72w-xml

  4. Edit php.ini
    In the file (vim /etc/php.ini) find ;cgi.fix_pathinfo=1 and change it to cgi.fix_pathinfo=0

  5. Create nginx users and groups
    groupadd -r nginx useradd -r -g nginx nginx This step is for insurance, just enter the above instructions separately, regardless of the prompt

  6. Edit php-fmp file
    vim /etc/php-fpm.d/www.conf

Change user = xxx and group = xxx in the figure to user = nginx, group = nginx

  1. Nginx pseudo-static settings (prevent article page 404)
    server{ location / { if (-f $request_filename/index.html){ rewrite (.) $1/index.html break; } if (-f $request_filename/index.php){ rewrite (.) $1/index.php; } if (!-f $request_filename){ rewrite (.*) /index.php; } } }
  2. Start fpm, set to start and restart nginx
    systemctl start php-fpm systemctl enable php-fpm systemctl restart nginx

Install MySQL8.0 service##

  1. First go to Official Website to check the latest installation package

  2. Download the MySQL source installation package

You can download it and upload it to the server with the xshell tool, or you can download it directly on the server with the command wget http://dev.mysql.com/get/mysql80-community-release-el7-3.noarch.rpm

  1. Install the yum source just downloaded
    yum -y install mysql80-community-release-el7-3.noarch.rpm
  2. Check the installation effect

  1. Well, start the installation!
    yum install mysql-community-server
    Here you can go for a cup of tea, it's really long! !

  2. Installation is complete Start MySQL service systemctl start mysqld.service may freeze

  3. View MySQL running status
    systemctl status mysqld.service

  1. Initialize the database password
    **View the initial password **grep "password" /var/log/mysqld.log

Use the password to log in to the account root

  1. Sign in
    mysql -uroot -p password is obtained in the previous step

  2. change Password
    ALTER USER'root'@'localhost' IDENTIFIED BY'****************';**** can be replaced with your password.
    mysql installs the password security check plugin (validate_password) by default. The default password check policy requires that the password must contain uppercase and lowercase letters, numbers, and special symbols, and the length cannot be less than 8 characters. Otherwise, it will prompt ERROR 1819 (HY000): Your password does not satisfy the current policy requirements error

  3. Set auto start
    systemctl enable mysqld``systemctl daemon-reload

Create new user##

create user 'username'@'localhost' identified by 'password';

Modify the authentication method to log in to phpmyadmin

ALTER USER'username'@'localhost' IDENTIFIED WITH mysql_native_password BY'your password';

Create database

create typecho;

Give database ownership

grant all on database.* to 'username'@'localhost' ;

Recommended Posts

CentOS6.7 build LNMP environment
Centos7.6 build LNMP environment
CentOS 7 build LNMP environment
Centos build lnmp
Build docker environment under Centos6.5
Build Discuz Forum in LNMP Environment under CentOS7
Build Dedecms website in LNMP environment under CentOS7
Build Nginx environment on Linux (CentOS)
CentOS7 build jenkins
Centos7 build python3.8.5+scrapy+gerapy
Centos-6.5 installation and deployment of LNMP environment
Steps to build LNMP environment on ubuntu 20.04
(1) Centos7 installation to build a cluster environment
[PHP] Build a PHP operating environment under CentOS
CentOS7.3 64 bit, build Zabbix3.4
CentOS build private git
install LNMP on centos7.4
Linux (centos7) build gitlab
Build k8s1.9.9 on centos7
Centos6.9 build rabbitmq 3.6.8 cluster
Hadoop environment construction (centos7)
lamp (centos7) installation lamp environment
Centos7 build Kubernetes cluster
Centos6.9 install npm environment
Jenkins build on centos
Build LEMP (Linux+Nginx+MySQL+PHP) environment under CentOS 8.1 (detailed tutorial)
Build Hadoop in CentOS
Centos7 build DNS service
Centos7 configure nodejs environment
Centos6.5 compile and install LNMP architecture web environment
How to build a LAMP environment on centos7.2
Configure CentOS7 GPU environment
Build a basic environment for Java development under Centos7
[CentOS environment deployment] Java7/Java8 deployment under CentOS
CentOs7.3 build Solr stand-alone service
Build OpenV** Server under CentOS7
Build zabbix monitoring zabbix4.2 in CentOS7.6
CentOS 7 install JAVA environment (JDK 1.8)
Build OpenLDAP server under CentOS7
SkyWalking study notes (CentOS environment)
Build zabbix monitoring zabbix4.2 in CentOS7.6
Build MariaDB replication on CentOS
Centos7 set up GitBook environment
CentOS 7.2 deploy Node.js development environment
CentOS install nginx+tomcat+java+mysql operating environment
CentOs7.3 build ZooKeeper-3.4.9 stand-alone service
Centos6 set up GitBook environment
CentOS environment installation of Docker
ubuntu build python development environment
CentOs7.3 build SolrCloud cluster service
Centos7 deploys python3 virtual environment
Centos7.4 environment installation lamp-php7.0 tutorial
Ubuntu 18.04.1 build Java environment and HelloWorld
CentOS 7 configure Java language development environment
CentOS8 deploys LNMP environment to compile and install mysql8.0.29 tutorial details
CentOS 8 (2)
CentOS 7 configure Ruby language development environment
CentOS8.1 build Gitlab server detailed tutorial
Ubuntu16.04 build php5.6 Web server environment
CentOS 7 configure php language development environment
Build a PXC cluster under CentOS8