Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

LAMP Construction based on RPM package

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

1. Configuration Summary:

A) 172.16.20.10 the host runs the httpd+php service (php is the module working mode)

B) configure two virtual hosts: wordpress personal blog system, PHPmyadmin remote control mysql

C) 172.16.20.11 host running mariadb service (mysql)

two。 Configuration process:

A) configure 172.16.20.10 host: http service first

i. Installation program

1. # yum install httpd php php-mysql php-mbstring

2. Httpd provides web services

3. A module that is automatically compiled to httpd after Php installation, which is used to handle dynamic resource php scripts.

4. Php-mbstring: this package is necessary for phpMyAdmin to remotely control mysql

5. The library file package of Php-mysql:php driver mysql

B) after the installation of the Rpm package is complete, proceed to the next configuration stage:

i. Add a virtual host (FQDN-based)

1. # Vim / etc/httpd/conf.d/vhost.conf file

Add the following, FQDN-based virtual host configuration

# fixed syntax can ignore case

ServerName # is very important. FQDN-based virtual hosts must have a hostname.

DocumentRoot "/ www/host/htdoc" # virtual host root directory, path can be specified

# permission settings for the root directory of the virtual host

OptionsFollowSymLinks # FollowSymLinks indicates that symbolic link resources can be accessed

Permission settings for the require allGranted # directory

ServerNamewww.myadmin.com

DocumentRoot "/ www/host2/htdoc"

OptionsFollowSymLinks

Require allGranted

C) create the resource directory defined in the configuration file for the virtual host

I. # mkdir/www/ {host,host2} / htdoc

D) add test resources

I. # vim / www/host/htdoc/index.php

# php code to test whether php is working properly

E) match proud httpd master profile

# vim / etc/httpd/conf/httpd.conf

# find DocumentRoot "/ var/www/html" # comment it out, usually when using a virtual machine to avoid conflicts # DocumentRoot "/ var/www/html"

# add php home page index

DirectoryIndexindex.php index.html # adds index.php first, so that such resource indexes are accessed by default

# Uncomment the server name

F) start the service and test whether it is normal

# check whether the syntax of the configuration file is incorrect

# httpd-t # start the service with correct syntax

# systemctl starthttpd.service Open a web page to check whether the service is working properly

The http service test is normal, and the php module works, but, as you can see, the connection to mysql failed because we haven't configured the mysql server yet.

G) obtain wordpress and phpmyadmin

Wordpress configuration:

# download and extract to / www/host/htdoc

# cd to wordpress directory

# copy configuration file wp-config-sample.php is wp-config.php

# cpwp-config-sample.php wp-config.php

# Editing configuration file

# vimwp-config.php

Define ('DB_NAME','wpdb'); # fill in the name of the database that mysql wants to authorize (which will be configured later)

/ * * MySQL database user name * /

Define ('DB_USER','wpuser'); # enter the user name of the database

/ * * MySQL database password * /

Define ('DB_PASSWORD','wppasswd'); # enter the password for the data

/ * * MySQL host * /

Define ('DB_HOST','172.18.17.8'); # enter the ip of the mysql host

/ * default text encoding when creating a datasheet * /

Define ('DB_CHARSET','utf8')

/ * * Database collation type. If you are not sure, do not change * /

Define ('DB_COLLATE','')

Phpmyadmin configuration:

# download and extract the package to / www/host2/htdoc

# cd to the file directory

# create a symbolic connection

# ln-s phpMyAdmin-4.4.14.1-all-languages myadmin

# ls

Index.php phpMyAdmin-4.4.14.1-all-languages

Myadmin phpMyAdmin-4.4.14.1-all-languages.zip

# modify the configuration file in the cd to the myadmin directory

# cp config.sample.inc.php config.inc.php

# Editing configuration file

# vim config.inc.php

$cfg ['blowfish_secret'] =' o71mI9rimj6syc00fT3gbread; / * YOU MUST FILL IN THIS FOR COOKIE AUTH! * /

# enter a random password in single quotation marks, which can be generated using openssl rand-base64 15 (password length)

/ *

* Servers configuration

* / $I = 0

/ * * First server

, /

$iTunes +

/ * Authentication type * /

$cfg ['Servers'] [$I] [' auth_type'] = 'cookie'

/ * Server parameters * /

$cfg ['Servers'] [$I] [' host'] = '172.18.17.8; # database host ip

$cfg ['Servers'] [$I] [' connect_type'] = 'tcp'

$cfg ['Servers'] [$I] [' compress'] = false

$cfg ['Servers'] [$I] [' AllowNoPassword'] = false

H) 172.16.20.11 Host configuration: mysql service

# yuminstall mariadb-server install mysql

# systemctlstart mariadb starts mysql service

# ss-tnl view listening port. 3306 is the default port.

Perform security operations

# mysql_secure_installation

It is strongly recommended that security actions be performed after the mysql installation is complete, which makes the database more secure

Create the required database and authorize

# mysql-uroot-p

Enterpassword:

Welcome to the MariaDBmonitor. Commands end with; or\ g.

Your MariaDB connectionid is 66

Server version:5.5.44-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or'\ h'for help. Type'\ c'to clear the current input statement.

MariaDB [(none)] > CREATE DATABASE wpdb; # create the database of wordpress

Query OK, 1 rowaffected (0.02 sec)

# authorizing wordpress database

MariaDB [(none)] > GRANT ALL ON wpdb.* TO wpuser@172.16.20.10 IDENTIFIED BY 'wppasswd'

Query OK, 0 rowsaffected (0.01 sec)

# authorize remote access host (phpMyadmin)

MariaDB [(none)] > GRANTALL ON *. * TO admin@'172.16.20.10' IDENTIFIED BY 'admin'

Query OK, 0 rowsaffected (0.01 sec)

3. Support all configurations are basically completed, verify the results

Verify database connectivity

4. Check to see if wordpress is normal

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report