In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-21 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
(1) configuration summary:
1. 172.16.100.31 host runs httpd+php service (php is the module working mode)
Configure two virtual hosts: wordpress personal blog system and PHPmyadmin remote control mysql
2. 172.16.100.31 host running mariadb service (mysql)
(2) configuration process:
First configure 172.16.100.31 host: http service
1. Installer:
[root@johnson's linux ~] # yum install httpd php php-mysql php-mbstring
=
Package Arch Version Repository Size
=
Installing:
Httpd x8631 64 2.4.6-40.el7.CentOS base 2.7m
Php x8631 64 5.4.16-36.el7_1 base 1.4m
Php-mbstring x8631 64 5.4.16-36.el7_1 base 503k
Php-mysql x8631 64 5.4.16-36.el7_1 base 99k
Transaction Summary
=
Httpd: provide web services
Php: a module that is automatically compiled to httpd after installation, and is used to handle dynamic resource php scripts
Php-mbstring: this package is necessary for phpMyAdmin to remotely control mysql
Library file package for php-mysql:php driver mysql
2. Service configuration
After the packages have been installed, proceed to the next configuration stage:
(1) add virtual hosts: (based on FQDN)
Virtual hosts can be configured in three ways: one is based on different ip, the same port (80), the second is different ports of the same IP, and the third is different host name (FQDN) of the same IP. No matter which configuration method, there is only one host parsed at last, but the information in the first part of the request message will be different! Below, only the FQDN-based configuration is demonstrated
Edit: / etc/httpd/conf.d/vhost1.conf file
[root@johnson's linux ~] # vim / etc/httpd/conf.d/vhost1.conf
[root@johnson's linux ~] # vim / etc/httpd/conf.d/vhost2.conf
# add the following content, virtual host configuration based on FQDN
# fixed syntax can ignore case
ServerName www1.wufeng.com # is very important. FQDN-based virtual hosts must have a hostname.
DocumentRoot "/ data/vhost/www1" # virtual host root directory, path can be specified
CustomLog logs/www1-access_log combined # specify the path and name of the log file
# permission settings for the root directory of the virtual host
Options None
AllowOverride None
Permission settings for the require all granted # directory
ServerName www2.wufeng.com
DocumentRoot "/ data/vhost/www2"
CustomLog logs/www2-access_log combined
Options None
AllowOverride None
Require all granted
Options: as an option for a directory, you can specify multiple properties
For example, Index, starts the resource index, and its function is to return the web resource index when the user accesses that the specified URL does not exist. This option
Very dangerous, it is not recommended to enable it, otherwise the source code will be exposed to web source code, and the consequences will be very serious.
Access permissions settings:
Require all Granted/deny, Granted: allow, all: all, deny: no
It should be noted that CentOS7 denies all hosts access to DocumentRoot resources by default, so this parameter must be configured to configure virtual hosts.
(2) create the resource directory defined in the configuration file for the virtual host and
[root@johnson's linux ~] # mkdir-pv / data/vhost/www {1jue 2}
(3) add test resources
[root@johnson's linux ~] # vim / data/vhost/www1/index.php
# the previous section is the PHP code that tests the connectivity between php and mysql
# php code to test whether php is working properly
(4) configure httpd master configuration file
Edit: / etc/httpd/conf/httpd.conf
[root@johnson's linux ~] # vim / etc/httpd/conf/httpd.conf
# find DocumentRoot "/ var/www/html", # comment it out, usually when using virtual machines, to avoid conflicts
# DocumentRoot "/ var/www/html"
# add php home page index
DirectoryIndex index.php index.html # adds index.php first, so that such resource indexes are accessed by default
# Uncomment the server name
(5) start the service and test whether it is normal or not
# check whether the syntax of the configuration file is incorrect
[root@johnson's linux ~] # httpd-t
# start the service with correct syntax
[root@johnson's linux ~] # systemctl start httpd.service
Open the web page to see if the service is normal.
The http service test is normal, and the php module works, but the connection to mysql fails because we haven't configured the mysql server yet.
(5) obtain wordpress and phpmyadmin
Wo is downloaded from the ftp server in the local area network
Wordpress configuration:
# download and extract to / data/vhost/www1
# cd to the wordpress directory, the configuration file is as follows
[root@johnson's linux wordpress] # ls
Index.php wp-blog-header.php wp-cron.php wp-mail.php
License.txt wp-comments-post.php wp-includes wp-settings.php
Readme.html wp-links-opml.php wp-signup.php
Wp-activate.php wp-config-sample.php wp-load.php wp-trackback.php
Wp-admin wp-content wp-login.php xmlrpc.php
# the wp-config-sample.php above the copy configuration file is wp-config.php
[root@johnson's linux wordpress] # cp wp-config-sample.php wp-config.php
# Editing configuration file
[root@johnson's linux wordpress] # vim wp-config.php
/ / * * MySQL settings-specific information comes from the host you are using * * / /
/ * * name of WordPress database * /
Define ('DB_NAME',' wpdb'); # enter the name of the database to be authorized by mysql (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.16.100.31'); # 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:
PhpMyAdmin-4.4.14.1-all-languages.zip# downloads and decompresses the package to / data/vhost/www1
# cd to the file directory
# create a symbolic connection
[root@johnson's linux htdoc] # ln-s phpMyAdmin-4.4.14.1-all-languages myadmin
[root@johnson's linux htdoc] # 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
[root@johnson's linux htdoc] # cp config.sample.inc.php config.inc.php
# Editing configuration file
[root@johnson's linux htdoc] # 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.16.100.31; # database host ip
$cfg ['Servers'] [$I] [' connect_type'] = 'tcp'
$cfg ['Servers'] [$I] [' compress'] = false
$cfg ['Servers'] [$I] [' AllowNoPassword'] = false
172.16.100.31 Host configuration: mysql service
(1) yum installer
[root@johnson's linux ~] # yum install mariadb-server
=
Installing:
Mariadb-server x86'64 1purl 5.5.44-2.el7.centos base 11 M
Installing for dependencies:
Mariadb x86x 64 1purl 5.5.44-2.el7.centos base 8.9m
Perl-Compress-Raw-Bzip2 x8631 64 2.061-3.el7 base 32k
Perl-Compress-Raw-Zlib x86x 64 1purl 2.061-4.el7 base 57k
Perl-DBD-MySQL x8631 64 4.023-5.el7 base 140k
Perl-DBI x8631 64 1.627-4.el7 base 802k
Perl-IO-Compress noarch 2.061-2.el7 base 260k
Perl-Net-Daemon noarch 0.48-5.el7 base 51k
Perl-PlRPC noarch 0.2020-14.el7 base 36k
Transaction Summary
=
A large number of dependent packages can be easily solved as long as there is yum and there is no problem with yum source configuration.
(2) start the service and perform safe installation operations
[root@johnson's linux ~] # systemctl start mariadb
# View the listening port. 3306 is the default listening port for mariaDB.
[root@johnson's linux ~] # ss-tnl
State Recv-Q Send-Q Local Address:Port Peer Address:Port
LISTEN 0 50 *: 3306 *: *
LISTEN 0 128 *: 22 *: *
LISTEN 0 128:: 22: *
Perform safe installation operation
[root@johnson's linux ~] # mysql_secure_installation
Setting the root password ensures that nobody can log into the MariaDB
Root user without the proper authorisation.
Set root password? Set the administrator login secret (this password has nothing to do with the root of the linux system)
New password:
Re-enter new password: # just enter the password
Password updated successfully!
Reloading privilege tables..
... Success!
Remove anonymous users? [YPop] y # whether to remove anonymous users (no password is required to log in before performing a secure installation)
... Success! # it is dangerous to allow anonymous login. It is recommended to remove it.
Disallow root login remotely? [YPAPO] n # whether the administrator account is not allowed to log in remotely, in general, it is not recommended.
... Skipping.
Remove test database and access to it? [YBO] y # remove test database
-Dropping test database...
... Success!
-Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
Will take effect immediately.
Reload privilege tables now? [YBO] y # overload permission table
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
Installation should now be secure.
Thanks for using MariaDB!
It is strongly recommended that you perform a secure installation after the mariaDB installation is complete, which can make the database more secure
(3) create the required database and authorize
[root@johnson's linux] # mysql-uroot-p
Enter password:
Welcome to the MariaDB monitor. Commands end with; or\ g.
Your MariaDB connection id 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 row affected (0.02 sec)
# authorizing wordpress database
# create a data name
MariaDB [(none)] > GRANT ALL ON wpdb.* TO 'wpuser'@'172.16.%.%' IDENTIFIED BY' wppass'
And then set up this database.
MariaDB [(none)] > CREATE DATABASE wpdb
(4) support all configurations are basically completed: verify the results
1. Verify database connectivity
2. Check whether the wordpress is normal.
Finally, I would like to add:
Common errors in phpMyadmin:
1. Missing mbstring plug-in
Yum, install php-mbstring.
two。 Missing session directory
Usually on / var/lib/php/session. If not, you can create it.
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.