Samba shared directory build wordpress and MySQL

Source: Internet
Author: User
Tags fpm mysql host

Project One

(1) using Samba to share/data/application/web, to provide WordPress in the directory;

(2) Use Samba client to Mount Samba server shared directory to/var/www/html;

(3) the client (lamp), deploy WordPress, and let its normal access, to ensure that the normal post, upload pictures;

(4) Client 2 (lamp), mount the Samba server shared directory to/var/www/html, check whether its WordPress can be accessed, to ensure that the normal post, upload pictures;

Samba Server side: 172.16.72.9

Samba Client 1:172.16.72.5

Samba Client 2:172.16.72.4

(1) Server-side configuration:

Installing Samba

Yum Install-y Samba

Shutting down the firewall

Iptables-f

Setenforce 0

To start Samba:

Systemctl Start Smb.service

To configure Samba:

/etc/samba/smb.conf

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/06/F0/wKiom1nAzEnhesnhAAAXqLedbFE217.png-wh_500x0-wm_ 3-wmp_4-s_1740159104.png "title=" Qq20170919154934.png "alt=" Wkiom1nazenhesnhaaaxqledbfe217.png-wh_50 "/>

Share name: [MyShare]

Note: Comment = my share

The path to the shared directory is:/data/application/web

Whether the browser can access: browseable = yes

Whether the system user has write access to the shared directory: writable = yes

Whether the shared directory is publicly accessible to all users: public = no

Wujunqi This user has write access to the shared directory: Write list = Wujunqi

Permissions for file creation (custom)

Permissions for directory Creation (custom)

Save exit when configuration file is complete and samba syntax detection using Testparm

Create a shared directory and reload the configuration file

Mkdir-pv/data/application/web

Systemctl Reload Smb.service


Import WordPress into the shared directory and unzip;

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/06/F1/wKiom1nAzf-DiIkdAAAU1ZhIYII971.png-wh_500x0-wm_ 3-wmp_4-s_3336814422.png "title=" Qq20170919155655.png "alt=" Wkiom1nazf-diikdaaau1zhiyii971.png-wh_50 "/>

Create Samba user Wujunqi, this user must already exist beforehand;

Because the user type is TDB, the command created is: Pdbedit

#pdbedit-U Wujunqi

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/A5/A1/wKioL1nAzjnwVlHIAAATB9DvOrc207.png-wh_500x0-wm_ 3-wmp_4-s_1750712257.png "title=" Qq20170919155845.png "alt=" Wkiol1nazjnwvlhiaaatb9dvorc207.png-wh_50 "/>

Remember this UID and GID, because you need to create a touch on the client side of the same Wujunqi user, easy to manage the files in WordPress;

#chown-R Wujunqi:wujunqi/data/application/web

#cp wordpress/wp-config-sample.php wordpress/wp-config.php

#vim wordpress/wp-config.php

#chmod o+w wordpress/wp-content

Editing a configuration file

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/06/F1/wKiom1nAzzjjHB90AAA-ntz-pyY836.png-wh_500x0-wm_ 3-wmp_4-s_1364896885.png "title=" Qq20170919160207.png "alt=" Wkiom1nazzjjhb90aaa-ntz-pyy836.png-wh_50 "/>

MySQL host for the server itself, so need to install MySQL

#yum install-y Mariadb-server

#systemctl Start Mariadb.service

Configure Database User Rights

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M00/A5/A1/wKioL1nAz3Lz75AhAAAGo0VgT0c769.png-wh_500x0-wm_ 3-wmp_4-s_3973877105.png "title=" Qq20170919160356.png "alt=" Wkiol1naz3lz75ahaaago0vgt0c769.png-wh_50 "/>

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M01/A5/A1/wKioL1nAz4nzZFfvAAAK6NHuSVI096.png-wh_500x0-wm_ 3-wmp_4-s_3569707280.png "title=" Qq20170919160419.png "alt=" Wkiol1naz4nzzffvaaak6nhusvi096.png-wh_50 "/>

Server-side configuration complete


Client Configuration:

172.16.72.5

View shared directory information on the server side

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M02/06/F1/wKiom1nA0B7QLCNbAABB-AAWVRE447.png-wh_500x0-wm_ 3-wmp_4-s_1710084071.png "title=" Qq20170919160556.png "alt=" Wkiom1na0b7qlcnbaabb-aawvre447.png-wh_50 "/>

Create mount point/var/www/html

Mkdir-pv/var/www/html

To configure the httpd:

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/06/F1/wKiom1nA0HiwsYwsAAA0CLHbqSs070.png-wh_500x0-wm_ 3-wmp_4-s_2956983188.png "title=" Qq20170919160727.png "alt=" Wkiom1na0hiwsywsaaa0clhbqss070.png-wh_50 "/>

Create a Wujunqi user and set its uid,gid

To open PHP:

Configure PHP-related information

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/06/F1/wKiom1nA0YugiH54AAAP0aUCFMs049.png-wh_500x0-wm_ 3-wmp_4-s_71496355.png "title=" Qq20170919161203.png "alt=" wkiom1na0yugih54aaap0aucfms049.png-wh_50 "/>"

Overloaded PHP Services:

Systemctl Reload Php-fpm.service

Mount the server-side shared directory to client 1:

Mount-t Cifs-o username=wujunqi,password=123456//172.16.72.9/myshare/var/www/html

(Can be mounted using a hidden user name and password)

To access the browser:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/A5/A2/wKioL1nA0q_yTQ2EAACAKObNd5Y092.png-wh_500x0-wm_ 3-wmp_4-s_1205234701.png "title=" Qq20170919161745.png "alt=" Wkiol1na0q_ytq2eaacakobnd5y092.png-wh_50 "/>

Upload text and images:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M00/A5/A2/wKioL1nA0t_A9pVEAADT3t1zTYo029.png-wh_500x0-wm_ 3-wmp_4-s_2441662893.png "title=" Qq20170919161832.png "alt=" Wkiol1na0t_a9pveaadt3t1ztyo029.png-wh_50 "/>

Upload success!!


Attach the server-side shared directory to client 2 again:

Shutting down the firewall

Installing Httpd,php-fpm,php-mysql

Set up a virtual host:/etc/httpd/conf.d/vhosts-www.conf

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M01/A5/A2/wKioL1nA1LWgYrLnAAA5Z0jqnT4512.png-wh_500x0-wm_ 3-wmp_4-s_2181253209.png "title=" Qq20170919162624.png "alt=" Wkiol1na1lwgyrlnaaa5z0jqnt4512.png-wh_50 "/>

Create Wujunqi users;

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/A5/A2/wKioL1nA1SjQJWZ2AAAQgFp4CrY972.png-wh_500x0-wm_ 3-wmp_4-s_429349546.png "title=" Qq20170919162818.png "alt=" Wkiol1na1sjqjwz2aaaqgfp4cry972.png-wh_50 "/>

To set the PHP-FPM configuration file:

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M02/06/F1/wKiom1nA1avzCtyLAAAOtQLlee8183.png-wh_500x0-wm_ 3-wmp_4-s_3852922305.png "title=" Qq20170919162933.png "alt=" Wkiom1na1avzctylaaaotqllee8183.png-wh_50 "/>

Heavy-duty PHP-FPM and httpd

Create mount point/var/www/html, and mount it;

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M00/A5/A2/wKioL1nA1iaTzanOAABm1_p1Lrc763.png-wh_500x0-wm_ 3-wmp_4-s_3916141267.png "title=" Qq20170919163211.png "alt=" Wkiol1na1iatzanoaabm1_p1lrc763.png-wh_50 "/>

To access the browser:

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M01/A5/A2/wKioL1nA1o-yZ0HUAAB3I_yF7z4160.png-wh_500x0-wm_ 3-wmp_4-s_1841158058.png "title=" Qq20170919163417.png "alt=" Wkiol1na1o-yz0huaab3i_yf7z4160.png-wh_50 "/>

Upload text and images:

650) this.width=650; "Src=" https://s1.51cto.com/wyfs02/M02/A5/A2/wKioL1nA1vWCfp5_AAE15XNP4vw843.png-wh_500x0-wm_ 3-wmp_4-s_81593434.png "title=" Qq20170919163558.png "alt=" Wkiol1na1vwcfp5_aae15xnp4vw843.png-wh_50 "/>

Upload success!!


Project two:

(1) Share/data/directory with samba;

(2) Let the Samba client mount the shared/data/to local/mydata directory on the Samba server, and the data directory of the local mysqld or MARIADB service is set to/mydata, requiring the service to start normally and to store the data normally;

Server-side host: 172.16.72.9

Client Host: 172.16.72.5

Server-side host: Create/data directory

#mkdir-pv/data

To configure the Samba master configuration file:

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/06/F3/wKiom1nA5SiCn_-QAAAVdfjFMHw000.png-wh_500x0-wm_ 3-wmp_4-s_3584562952.png "title=" Qq20170919173544.png "alt=" Wkiom1na5sicn_-qaaavdfjfmhw000.png-wh_50 "/>

Samba user is set to MySQL

Create a MySQL user and set it as a samba user

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/06/F3/wKiom1nA5YTAw-gLAAAvgEMHmE0271.png-wh_500x0-wm_ 3-wmp_4-s_2141424776.png "title=" Qq20170919173714.png "alt=" Wkiom1na5ytaw-glaaavgemhme0271.png-wh_50 "/>

Set/data subordinate permissions to MySQL for easy client management:

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M02/A5/A4/wKioL1nA5kPgI1VUAAAKS17M4Wc437.png-wh_500x0-wm_ 3-wmp_4-s_2502838932.png "title=" Qq20170919174116.png "alt=" Wkiol1na5kpgi1vuaaaks17m4wc437.png-wh_50 "/>

Client Configuration:

Download MySQL;

Mount the server-side/data to the created directory/mydata

#mount-T Cifs-o username=mysql,password=123456//172.16.72.9/myshare/mydata

Change the DataDir path of the/etc/my.cnf configuration file in mariadb to mount point/mydata

650) this.width=650; "Src=" https://s3.51cto.com/wyfs02/M00/A5/A4/wKioL1nA6k_SyD4fAAASLsUEPhg783.png-wh_500x0-wm_ 3-wmp_4-s_1632255266.png "title=" Qq20170919175834.png "alt=" Wkiol1na6k_syd4faaaslsuephg783.png-wh_50 "/>

Overloaded MySQL

Systemctl Start Mariadb.service

Test whether MySQL writes data normally:

Create DATABASE succeeded

650) this.width=650; "Src=" https://s4.51cto.com/wyfs02/M00/A5/A4/wKioL1nA6o7jpbsXAAAinnCE7Ts391.png-wh_500x0-wm_ 3-wmp_4-s_1167180498.png "title=" Qq20170919175936.png "alt=" Wkiol1na6o7jpbsxaaainnce7ts391.png-wh_50 "/>

CREATE TABLE succeeded:

650) this.width=650; "Src=" https://s5.51cto.com/wyfs02/M02/06/F3/wKiom1nA6uShO1ElAAAN99Tw0pg225.png-wh_500x0-wm_ 3-wmp_4-s_2548185259.png "title=" Qq20170919180006.png "alt=" Wkiom1na6usho1elaaan99tw0pg225.png-wh_50 "/>

650) this.width=650; "Src=" https://s2.51cto.com/wyfs02/M01/A5/A4/wKioL1nA6tKw0RumAAAYiR2Mai0344.png-wh_500x0-wm_ 3-wmp_4-s_1134996809.png "title=" Qq20170919180043.png "alt=" Wkiol1na6tkw0rumaaayir2mai0344.png-wh_50 "/>


Samba shared directory build wordpress and MySQL

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.