Deploy Lamp based on php module

Source: Internet
Author: User
Deployment of Lamp based on the php module: (1) CentOS 7 is separated from two hosts, one is httpd and php, and the other is mariadb;

(2) deploy two virtual hosts: wordpress and phpMyAdmin;

(3) provide https virtual hosts for phpMyAdmin;

Deployment process:

1. install httpd and php, php-mysq, and mariadb-server and enable the service

Install httpd and php services on the first host (web:

Here yum is used for installation:

Yum-y install httpd php

To communicate with mariadb, you also need to install php-mysql

Yum-y install php-mysql

Install the mariadb-server service on the second host (mariadb:

Yum-y install mariadb-server

Enable the httpd and mariadb services respectively:

The httpd service is enabled and port 80 is in the listening status;

The mariadb service is enabled and Port 3306 is in the listening status;

II. httpd service and php status test:

Vim/var/www/html/index. php

Browser test:

III. test connectivity between mariadb and php

Add and authorize users in mariadb:

Enable mariadb reverse resolution and restart the service:

Vim/etc/my. cnf. d/server. cnf

Add: skip_name_resolve = ON

Test the connectivity between mariadb and php:

Vim/var/www/html/index. php

Test the browser:

Connection successful;

4. add two virtual hosts

Add a wordpress VM:

Add a phpMyAdmin VM:

Conf. d] # vim vhost_pma.conf

Test two VM instances:

Comment out DoucumenRoot in the main configuration file/etc/httpd/conf/httpd. conf:

Vim/etc/httpd/conf/httpd. conf

Create a test page under the DocumentRoot directory of each VM:

Vim/www/mywp.com/index.php

Vim/www/mypma.com/index.php

Browser test: Note: you must add domain name resolution to the hosts file of the test host;

5. add and authorize the wordpress and phpMyAdmin databases and users on the mariadb host

Create a database:

Create and authorize a User:

Test the connectivity between the VM and mariadb:

Vim/www/mywp.com/index.php

Vim/www/mypma.com/index.php

Browser test:

6. provide wordpress

Download the wordpress compressed package and decompress it to the DocumentRoot Directory of the wordpress virtual machine:

Create and edit profile: wp-config.php

Browser test: www.mywp.com/wordpress

Created successfully. you can register and use it;

7. provide phpMyAdmin and https virtual hosts for phpMyAdmin

1. provide https virtual hosts:

Apply for a certificate from CA:

Create a private key:

Create an application certificate file and send it to the CA host to sign the certificate:

The process of applying for a certificate file to a CA host and signing itself with the CA host will not be demonstrated;

CA host signing certificate:

The signing is successful, and the signed certificate is sent to the requesting host;

Install the ssl module: yum-y install mod_ssl

Edit the ssl configuration file: vim/etc/httpd/conf. d/ssl. conf

Browser test:

2. provide phpMyAdmin

Download the phpMyAdmin compressed package and decompress it to the DocumentRoot Directory of the ssl virtual host:

Create and edit the configuration file:

Create a configuration file:

Generate a random code:

Edit the configuration file and add the random code to the configuration file: $ cfg ['blowfish _ secret'] = 'random code ';

And mariadb server address;

Install the character conversion package php-mbstring: yum-y install php-mbstring

Browser test:

Use the user name and password you have authorized to log on:

So far, the entire deployment has been completed!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.