CentOS 6.9 yum to build LNMP environment and deploy Discuz forum

1. Demonstration environment:

IP

installed package

Version

192.168.1.144

nginx epel _

1.10.2

php

5.3.3

php-fpm ( FastCGI Process Manager)

php-mysql ( the driver that php needs to use when connecting to mysql )

192.168.1.145

MySQL-server-5.6.39-1.el6.x86_64.rpm

MySQL-client-5.6.39-1.el6.x86_64.rpm

MySQL-devel-5.6.39-1.el6.x86_64.rpm

MySQL-shared-5.6.39-1.el6.x86_64.rpm

MySQL-shared-compat-5.6.39-1.el6.x86_64.rpm

5.6.39

   Remarks: The version of mysql installed by yum in CentOS 6.9 is 5.1.73 by default . Here , the rpm package of version 5.6.39 is used to install mysql

2. Build LNMP :

1. Preparation before installation:

   (1) Proofreading server time

   (2) Configure the epel source

2、安装nginx# yum -y install nginx  # service nginx start  # ss -tunlp | grep :80

   Configuration file:

Ø   Main configuration file: /etc/nginx/nginx.conf

Ø   Auxiliary configuration files: /etc/nginx/* , /etc/nginx/conf.d

3.   Install php : # yum -y install php , configuration file: /etc/php.ini

4.   Install and configure php-fpm :

      # yum -y install php-fpm

      # vim /etc/php-fpm.d/www.conf , modify the values ​​of the following parameters:

      listen = 192.168.1.144:9000 // The address port that php-fpm listens to

      listen.allowed_clients = 192.168.1.144 // The FastCGI client address that is allowed to connect

      user = nginx

      group = nginx

      # service php-fpm start

      # ss -tunlp | grip: 9000

   Configuration file:

Ø   Main configuration file: /etc/php-fpm.conf

Ø   Auxiliary configuration file: /etc/php-fpm.d/www.conf

5.   Install and configure mysql :

      # rpm -qa | grep -i mysql // Check whether the old version of mysql related components are installed

      # yum -y remove mysql-libs*

      // Switch to store MySQL-client-5.6.39-1.el6.x86_64.rpm , MySQL-server-5.6.39-1.el6.x86_64.rpm , MySQL-shared-compat-5.6.39-1.el6 .x86_64.rpm , MySQL-devel-5.6.39-1.el6.x86_64.rpm , MySQL-shared-5.6.39-1.el6.x86_64.rpm directory

     # yum -y install *.rpm

     # find / -name my*.cnf

     # cp /usr/share/mysql/my-default.cnf /etc/my.cnf //mysql configuration file: /etc/my.cnf

     # find / -name mysql.server

     # cp /usr/share/mysql/mysql.server /etc/init.d/mysqld

     # service mysqld start

     # ss -tunlp | grip: 3306

     # cat /root/.mysql_secret // View the random password of the root user of the mysql database

    // Modify the mysql database root user password to 123456 , delete anonymous users, delete the test database, and reload the authorization table

    # mysql_secure_installation

    # mysql -uroot -p

   1.jpg

   mysql> grant all on *.* to 'root'@'192.168.%.%' identified by '123456'; // Authorize root user to log in remotely

   mysql> flush privileges;

6. Install php-mysql : # yum -y install php-mysql

7.  Configure nginx to support php :

      # cd /etc/nginx/conf.d

      # cp default.conf default.conf.bak

      # vim default.conf

   2.jpg

      # service nginx reload

      # service php-fpm restart

3. Test LNMP :

      # cd /usr/share/nginx/html

      # vim index.php

   3.jpg


Enter http://192.168.1.144/index.php    in the browser :

4.jpg


Stop mysql on 192.168.1.145 : # service mysqld stop

5.jpg

The communication between mysql and php is normal


Visit http://192.168.1.144

6.jpg


Fourth, install and configure Discuz :

       Discuz is a community-based professional website building platform launched by Comsenz , a subsidiary of Tencent . The platform ( Open Platform ) is fully integrated to help the website achieve one-stop service. The download address is http://www.discuz.net/forum-10-1.html , here Discuz_X3.4_SC_UTF8.zip is used as an example.

       # yum -y install unzip

       # unzip -q Discuz_X3.4_SC_UTF8.zip

       # cp -r upload/ /usr/share/nginx/html

       # cd /usr/share/nginx/html/upload

       # chmod -R 777 config/ data/ uc_client/ uc_server/

       # vim config/config_global_default.php

   7.jpg


      # vim config/config_ucenter_default.php

   8.jpg

      # mysql -uroot -p

      mysql> create database dcdb;

      mysql> grant all on dcdb.* to 'dcuser'@'%' identified by "123456";

      mysql> flush privileges;

      # mysql -udcuser -p

      mysql> show databases;

   9.jpg

   Modify the nginx configuration file and add index.php after the index parameter :

      # vim /etc/nginx/conf.d/default.conf

      location / {

      index index.php index.html index.htm;

      }

      # service nginx reload

Enter http://192.168.1.144/upload/install/    in the browser

10.jpg


Click "I Agree":

11.jpg

12.jpg


Check the installation environment, after all pass, click "Next":

13.jpg


Select "New installation of Discuz! X (including UCenter Server )", and click "Next":

14.jpg


Fill in the database information and administrator information, and click "Next":

15.jpg

16.jpg


Click "Your forum has been installed, click here to visit":

17.jpg


You can log in with the admin account in the upper right corner :

18.jpg


Click "Management Center" in the upper right corner, and delete the installation page according to the prompts:

19.jpg

20.jpg

# rm -rf /usr/share/nginx/html/upload/install/index.php

# cd /usr/share/nginx/html

# mv upload/ discuz

Forum front desk login address http://192.168.1.144/discuz/

Forum background management address http://192.168.1.144/discuz/admin.php

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324627149&siteId=291194637