Three host deployment lamp (FAST-CGI)

Source: Internet
Author: User
Tags phpmyadmin

Three host deployment lamp (fast-cgi)

Experimental requirements:

Create two virtual host web1,web2, respectively run phpMyadmin,wordpress, and for PhpMyadmin provides HTTPS services.

Three hosts:

1.cehtos7.2 Run httpd.2-4 a nic eno16777728 bridging mode IP 172.16.254.79/16

2.centos7.2 Run php-fpm a nic eno16777728 bridging mode IP 172.16.250.205/16

3.centos7.2 Run mariadb-server a nic eno16777728 bridging mode IP 172.16.252.180/16

Three hosts to install the required packages:

1.yum-y Install httpd samba Mod-ssl

2.yum-y Install php-fpm php-mysql cifs-utils php-mbstring

3.yum-y Install Mariadb-server

configuration of the HTTPD host:

Create a root directory of two virtual sites:

mkdir/data/web{1,2}-PV

Chown apache:apache/data/web{1,2}

Share the two directories /data/web1,/data/web2 through samba .

Vim/etc/samba/smb.conf[php]

comment=php data

Path=/data/web1

Browseable=yes

Write List=apache

[WordPress]

Comment=wordpress data

Path=/data/web2

Browseable=yes

Write List=apache

PDBEDIT-A-U Apache

Passwdord 123456

Start Samba Server

Systemctl Start Smb.service

Systemctl Start Nmb.service

Create a configuration file for the two virtual host web1,web2 :

<virtualhost 172.16.254.79>

ServerName www1.wudang.com

Documentroot/data/web1

DirectoryIndex index.php

Errorlog Logs/www1_error_log

Customlog Logs/www1_access_log combined

Proxyrequests OFF

Proxypassmatch ^/(. *\.php) $ fcgi://172.16.250.205:9000/data/web1/$1

<Directory/data/web1/>

Options Indexes FollowSymLinks

allowoverride None

Require all granted

</Directory>

</VirtualHost>

<virtualhost 172.16.254.79>

ServerName www2.shaolin.com

Documentroot/data/web2

DirectoryIndex index.php

Errorlog Logs/www2_error_log

Customlog Logs/www2_access_log combined

Proxyrequests OFF

Proxypassmatch ^/(. *\.php) $ fcgi://172.16.250.205:9000/data/web2/$1

<Directory/data/web2/>

Options Indexes FollowSymLinks

allowoverride None

Require all granted

</Directory>

</VirtualHost>

Download Phpmyadmin-4.4.14.1-all-languages.zip Wordpress-4.3.1-zh_cn.zip

Unzip the two application packages to the site root directory:

Unzip Phpmyadmin-4.4.14.1-all-languages.zip

Unzip Wordpress-4.3.1-zh_cn.zip

To create a soft connection file for two application root directories:

Ln-svf/data/web1/phpmyadmin-4.4.14.1-all-languages/data/web1/mpa

Ln-svf/data/web2/wordpress/data/web2/wordpress

Configure two applications to connect to the database mariadb :

cp/data/web1/mpa/config.sample.inc.php/data/web1/mpa/config.inc.php

vim/data/web1/mpa/config.inc.php

$cfg [' blowfish_secret '] = ' 1rnbfovowly6ga '; ---- generate a random number of keys

$cfg [' Servers '] [$i] [' host '] = ' localhost ';-------------mariadb host address

cp/data/web2/wordpress/wp-config-sample.php/data/web2/wordpress/wp-config.php

vim/data/web2/wordpress/wp-config.php

Define (' db_name ', ' WordPress ');------- Pre-created database

/** MySQL Database user name * /

Define (' Db_user ', ' Jack ');-------- the user name of the management database

/** MySQL Database Password */-----Jack user to connect to database password

Define (' Db_password ', ' 123456 ');

/** MySQL Host * /

Define (' Db_host ', ' 172.16.254.79 ');------- the address of the MARIADB database

Start mariadb

configuration of the Mariadb-server host:

Systemctl Strart Mariadb.service

Connecting to a database

Mysql

Create a database User:

Grant All on * * to ' Jack ' @ ' % ' identified by ' 123456 '  ;

Flush privileges;

Start httpd

Systemctl Start httpd

configuration of the PHP-FPM host:

mkdir/data/web{1,2}

mkdir/data/web{1,2}-PV

Mount.cifs-o Username=apache//172.16.254.79/php/data/web

Mount.cifs-o Username=apache//172.16.254.79/WORDPRESS/DATA/WEB2

Mkdir/var/lib/php/session

Chown apache:apache/var/lib/php/session

Vim/etc/php-fpm.d/www.conf

Listen = 172.16.250.205:9000

; Default Value:any

#listen. allowed_clients = 127.0.0.1----- Allow any host to reverse access

Start php-fpm

Systemctl Start PHP-FPM

HTTP service test: Test machine Win7 hosts file adds a record

172.16.254.79 www1.wudang.com www2.shaolin.com

Http://www1.wudang.com/mpa

650) this.width=650; "Src=" Http://s3.51cto.com/wyfs02/M01/85/70/wKiom1ejRiHBEZfpAABcaCihdOY271.jpg-wh_500x0-wm_3 -wmp_4-s_4226248734.jpg "title=" capture. JPG "width=" "height=" 387 "border=" 0 "hspace=" 0 "vspace=" 0 "style=" WIDTH:600PX;HEIGHT:387PX; "alt=" Wkiom1ejrihbezfpaabcacihdoy271.jpg-wh_50 "/>

Http://www2.shaolin.com/wordpress

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M00/85/70/wKiom1ejRtHyXKLOAABu1UtDWLM948.jpg-wh_500x0-wm_3 -wmp_4-s_2151462894.jpg "title=" 2.JPG "alt=" wkiom1ejrthyxkloaabu1utdwlm948.jpg-wh_50 "/>

To create a CA Certificate:

(Umask 066; OpenSSL genrsa-out Private/cakey.pem 1024)

OpenSSL req-new-x509-key private/cakey.pem-days 3650-out Cacert.pem

To create a site phpMyadmin private key and certificate:

(Umask 066;openssl genrsa-out/etc/httpd/web1/php.key 1024x768) OpenSSL req-new-key/etc/httpd/web1/php.key-days 365-out /etc/httpd/web1/php.csr

OpenSSL ca-in/etc/httpd/web1/php.csr-out Certs/php.crt

Listen 443 httpsi

<virtualhost 172.16.254.79:443>

DocumentRoot "/data/web1/"

ServerName www1.wudang.com:443

Proxyrequests OFF

Proxypassmatch ^/(. *\.php) $ fcgi://172.16.250.205:9000/data/web1/$1

Sslprotocol All-sslv2

DirectoryIndex index.php

Sslengine on

Errorlog Logs/www1_ssl_error_log

LogLevel warn

Sslcertificatefile/etc/httpd/web1/php.crt

Sslcertificatekeyfile/etc/httpd/web1/php.key

<Directory/data/web1/>

Options Indexes FollowSymLinks

allowoverride None

Require all granted

</Directory>

</VirtualHost>

Import the CA 's certificate into the trusted root certificate machine in the browser and construction.

HTTPS test:

Https://www1.wudang.com/mpa

650) this.width=650; "Src=" Http://s2.51cto.com/wyfs02/M02/85/70/wKiom1ejRvKx_x9TAABrC6yymVI659.jpg-wh_500x0-wm_3 -wmp_4-s_1015229995.jpg "title=" 3.JPG "alt=" wkiom1ejrvkx_x9taabrc6yymvi659.jpg-wh_50 "/>


This article from the "11175786" blog, reproduced please contact the author!

Three host deployment lamp (FAST-CGI)

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.