In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
CentOS 7, lamp (module)
Requirements: (1) the three are separated from two hosts
(2) one virtual host is used to provide phpMyAdmin; and the other virtual host is used to provide wordpress
(3) xcache
(4) provide https virtual host for phpMyAdmin
Planning: running http server and php back-end scripts on 172.18.105.110
172.18.17.191 run the database
Preparatory work
I finished the DNS ahead of time. The two A records of 172.18.105.110 correspond to www1.stu05.com www2.stu05.com.
1. On 172.18.105.110 yum install httpd php php-mysql-y Note: at this time php is the module as httpd
Install the database on 172.18.17.191 yum install mariadb.server-y
Systemctl start httpd
Extension: 2.4http supports fastcgi, if you want to use to replace php with php-fpm
two。 Close the # DocumentRoot "/ var/www/html" of the central host
3. Configure the root directory of the virtual host
Mkdir-pv / web/vhosts/www1
Mkdir-pv / web/vhosts/www2
4. Configure FQDN-based virtual host vim / etc/httpd/conf.d/vhosts
Virtual host one
ServerName www1.stu05.com
DocumentRoot "/ web/vhosts/www1"
AllowOverride None
Options None
Require all granted
Virtual host II
ServerName www2.stu05.com
DocumentRoot "/ web/vhosts/www2"
AllowOverride None
Options None
An error occurred while checking the syntax httpd-t:
Httpd: Could not reliably determine the server's fully qualified domain name, using localhost.localdomain. Set the 'ServerName' directive globally to suppress this message
Reason: httpd: unable to reliably determine the fully qualified domain name of the server, using localhost.localdomain. Set the 'ServerName directive to suppress this message globally
Solution: vim / etc/httpd/conf/httpd.conf first finds ServerName (about 213 lines) and sets it to localhost:80
5. Test whether the virtual site of http is working
Vim / web/vhosts/www1 and / web/vhosts/www1
Vim index.html
Www2 site www2 × × www1 site www1 × × ×
Type www1.stu05.com www2.stu05.com in the browser-the local dns is already pointing to the local
6.rpm-ql php checks whether the libphp5.so module corresponds to the httpd enabled mpm module is prefork
Note: check whether the library of php matches the multiprocessing module of mpm of httpd before testing.
Rpm View Library rpm-ql php httpd View enable Module vim / etc/httpd/conf.modules.d/00-mpm.conf
Php library: libphp5.so module: LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
Php library: libphp5-zts.so module: LoadModule mpm_worker_module modules/mod_mpm_worker.so
LoadModule mpm_event_module modules/mod_mpm_event.so
7. Test whether the connectivity between httpd and php is normal vim / web/vhosts/www1 and / web/vhosts/www1
Vim index.php
Php test code
Browser http://www1.stu05.com http://www2.stu05.com
7. Test whether the connection between php and mysql-server is normal
Log in to mysql as an administrator and authorize remote login users
CREATE DATABASE wpdb1; creates a database
(1) GRANT ALL ON wpdb1.* TO wpuser1@'172.18.%.%' IDENTIFIED BY 'wpuser1'
Note: GRANT authorizes hosts on network segment 172.16.0.0 to remotely access all tables of testdb through testuser.
(2) FLUSH PRIVILEGES refresh takes effect immediately
Viewable user: SELECT USER ()
Test whether remote users can log in to the database: mysql-uwpuser1-h272.18.17.191-pwpuser1
(3) reverse the user name when logging in with mysql off.
Add skip_name_resolve = ON after [mysqld] in the vim / etc/my.cnf configuration file
Then reload service mysqld reload
After putting it separately in index.php, run http://172.18.105.110
The lamp environment is successful.
Summary:
Any open source program needs to connect to the database, in the case of testing the lamp connection database ok, if it is a remote connection, you need to create an authorized remote connection user, while workdpress not only needs to create a database, but also needs an authorized remote connection user.
Remote host login database define ('DB_HOST',' 172.18.250.157'); local host login database define ('DB_HOST',' 127.0.0.1')
Local database root login if there is a password mysql-uroot-pxwj4611
If the local database root does not have a password mysql
8. The first virtual host runs wordpress
Cp wordpress-4.3.1-zh_CN.zip / web/vhosts/www1/
Unzip wordpress-4.3.1-zh_CN.zip
Ln-sv wordpress-4.3.1-zh_CN wordpress and then cd / wordpress
1 、 cp wp-config-sample.php wp-config.php
2. Execute mysql or if the local root has set the password mysql-uroot-pxwj4611-CREATE DATABASE wpdb; to create the database, most open source programs will create the database automatically.
3. GRANT ALL ON wpdb.* TO wpuser@'172.18.%.%' IDENTIFIED BY 'wppress'
Note: authorize this software to allow a user to connect to the database remotely, if it is a local connection 127.0.0.1
4. Vim vp-config.php edit configuration file
/ * * name of WordPress database * /
Define ('DB_NAME',' wpdb1')
/ * * MySQL database user name * /
Define ('DB_USER',' wpuser1')
/ * * MySQL database password * /
Define ('DB_PASSWORD',' wpuser1')
/ * * MySQL host * /
Define ('DB_HOST',' 172.18.17.191'); if it is a local connection to loaclhost or 127.0.0.1
Test: www1.stu05.com/wordpress stress test ab-n 1000-c 100 http://www2.stu05.com/wordpress/index.php-c simulated concurrency-n simulated total number of requests
The local test does not take into account the bandwidth, the server may not run full bandwidth. Requests per second: 8.85 [# / sec] (mean) requests processed per second
9. The second virtual host runs phpMyAdmin
Preparatory work: cp phpMyAdmin-4.4.14.1-all-languages.zip / web/vhosts/www1/
Unzip phpMyAdmin-4.4.14.1-all-languages.zip
Ln-sv phpMyAdmin-4.4.14.1-all-languages pma Note: easy to roll back
I need to prepare an authorized remote link for the user who connects to the database in advance: can log in everywhere
(1), execute mysql or if the local root has set the password mysql-uroot-pxwj4611
(2), GRANT ALL ON wpdb.* TO myuser@'172.18.%.%' IDENTIFIED BY 'myuser'
Modify the configuration file for phpMyAdmin to connect to the database
(1) cp config.sample.inc.php config.inc.php
(2) openssl ran-base64 15
(3) vim config.inc.php
$cfg ['blowfish_secret'] =' 46aJFLiLxmqO0qrdGqwxupload; / * YOU MUST FILL IN THIS FOR COOKIE AUTH! * /-inside the random number
$cfg ['Servers'] [$I] [' host'] = '172.18.17.191remote connection to the host of the database
Test: www1.stu05.com/pma
Concurrency of stress test ab-n 1000-c 100 http://www1.stu05.com/pma/index.php-c simulation-total number of requests for n simulation
10. Compile and install xcache
# yum install php-devel
# cd xcache-3.2.0
# phpize
#. / configure-enable-xcache-with-php-config=/usr/bin/php-config
# make & & make install
# cp xcache.ini / etc/php.d/
Restart systemctl restart php-fpm
11. Provide https virtual host for phpMyAdmin
ServerName www1.stu05.com
DocumentRoot "/ web/vhosts/www1/myadmin"
SSLEngine on
SSLCertificateFile / etc/httpd/ssl/httpd.crt- points to the location of the certificate
SSLCertificateKeyFile / etc/httpd/ssl/httpd.key- points to the location of the public key
AllowOverride None
Options FollowSymLinks-- allows access to the source files of linked files
Require all granted
Test: local host points to dns
Browser https://www1.stu05.com http://www2.stu05.com/wordpress
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.