Deploy social networking sites

Source: Internet
Author: User
Tags php server svn client nginx server

Project case: Deploying social networking sites


This project is to build a dynamic Web server platform, running social networking sites (for example: Renren, net, Tianya forum). Relevant knowledge points are involved in the previous course, today's experiment is a comprehensive application, reflecting the real project implementation process and ideas. This experiment has a new knowledge point, is the SVN server, SVN server can be unified storage programmer development Code, to avoid code confusion, it is easy to say that SVN is used for many people to jointly develop the same project, the purpose of sharing resources, a bit similar to the file server, but more secure than the file server, It is advantageous for many people to maintain, avoids the work coordination to appear the problem. In addition, our environment today is to realize the separation of Nginx, PHP, MySQL, which helps to optimize the environment, improve performance and security.


I. Description of the project
1. Build SVN server
2. Deploy Nginx server to handle static Web pages
3. Deploy PHP server to handle Dynamic Web pages
4. Deploy MySQL server for dynamic site database storage
5, configure Nginx and PHP, use SVN to publish the development of a good website
6. Browse the website on the client



Second, the experimental topology

650) this.width=650; "title=" 2017-09-28_102838.png "alt=" wkiom1nmxurwxubhaabn6xzs4l4229.png-wh_50 "src=" https:// S5.51cto.com/wyfs02/m00/07/99/wkiom1nmxurwxubhaabn6xzs4l4229.png-wh_500x0-wm_3-wmp_4-s_735339614.png "/>


Third, build SVN server


1. Install SVN (default already installed)

650) this.width=650; "title=" 2017-09-28_103143.png "alt=" wkiol1nmxw3yhzqzaabjfavhx10453.png-wh_50 "src=" https:// S4.51cto.com/wyfs02/m00/a6/4b/wkiol1nmxw3yhzqzaabjfavhx10453.png-wh_500x0-wm_3-wmp_4-s_3219016064.png "/>


2. Create a warehouse directory for PHP programmers repo (for unified storage development data)

650) this.width=650; "title=" 2017-09-28_103217.png "alt=" wkiom1nmx2jixzqgaabu9amuvzq589.png-wh_50 "src=" https:// S3.51cto.com/wyfs02/m02/07/9a/wkiom1nmx2jixzqgaabu9amuvzq589.png-wh_500x0-wm_3-wmp_4-s_4200069496.png "/>

3. Adjust SVN parameters
Vim/opt/svn/repo/conf/svnserve.conf

650) this.width=650; "title=" 2017-09-28_103430.png "alt=" wkiom1nmx_krm30raaa4ontqemu950.png-wh_50 "src=" https:// S3.51cto.com/wyfs02/m01/07/9a/wkiom1nmx_krm30raaa4ontqemu950.png-wh_500x0-wm_3-wmp_4-s_2272301088.png "/>

650) this.width=650; "title=" 2017-09-28_103514.png "alt=" wkiom1nmybrapjaxaagszyqrupe272.png-wh_50 "src=" https:// S1.51cto.com/wyfs02/m02/07/9a/wkiom1nmybrapjaxaagszyqrupe272.png-wh_500x0-wm_3-wmp_4-s_3589342374.png "/>

Explain:
Anon-access = none//anonymous user does not have any permissions
auth-access = write//authenticated user has Write permission
PASSWORD-DB =/OPT/SVN/REPO/CONF/PASSWD//user's password file
AUTHZ-DB =/opt/svn/repo/conf/authz//user information file

4. Start SVN service (Stop svnserve using killall-9 svnserve)

650) this.width=650; "title=" 2017-09-28_103557.png "alt=" wkiom1nmyesimwydaabif3lsiys314.png-wh_50 "src=" https:// S4.51cto.com/wyfs02/m01/07/9a/wkiom1nmyesimwydaabif3lsiys314.png-wh_500x0-wm_3-wmp_4-s_2083904452.png "/>

5, for PHP programmer Ydw Set up a user, configure the Repo warehouse has read and write permissions, and the account information and warehouse directory feedback to the PHP programmer.

650) this.width=650; "title=" 2017-09-28_103635.png "alt=" wkiom1nmygqqed1caabdsidda44418.png-wh_50 "src=" https:// S2.51cto.com/wyfs02/m00/07/9a/wkiom1nmygqqed1caabdsidda44418.png-wh_500x0-wm_3-wmp_4-s_370163136.png "/>

Create an account password file for authentication during client synchronization

650) this.width=650; "Width=" 526 "height=" 422 "title=" 2017-09-28_103736.png "style=" WIDTH:404PX;HEIGHT:349PX; "alt=" Wkiom1nmylqjoochaaavkqvq18c391.png-wh_50 "src=" https://s4.51cto.com/wyfs02/M00/07/9A/ Wkiom1nmylqjoochaaavkqvq18c391.png-wh_500x0-wm_3-wmp_4-s_3490918985.png "/>

Create permission profiles, set read and Write permissions

650) this.width=650; "title=" 2017-09-28_103842.png "alt=" wkiom1nmyoqbmox_aaatxtfgjwu025.png-wh_50 "src=" https:// S4.51cto.com/wyfs02/m01/07/9a/wkiom1nmyoqbmox_aaatxtfgjwu025.png-wh_500x0-wm_3-wmp_4-s_70558086.png "/>


650) this.width=650; "width=" 525 "height=" 357 "title=" 2017-09-28_103915.png "style=" WIDTH:424PX;HEIGHT:317PX; "alt=" Wkiol1nmymujdga_aaanz5v9ofm119.png-wh_50 "src=" Https://s3.51cto.com/wyfs02/M00/A6/4B/wKioL1nMYMujdga_ Aaanz5v9ofm119.png-wh_500x0-wm_3-wmp_4-s_2649346503.png "/>

Create a subdirectory of the user store development data webphp, and initialize the SVN directory

650) this.width=650; "title=" 2017-09-28_104011.png "alt=" wkiom1nmyuahtkd6aabomwsixmw608.png-wh_50 "src=" https:// S3.51cto.com/wyfs02/m02/07/9a/wkiom1nmyuahtkd6aabomwsixmw608.png-wh_500x0-wm_3-wmp_4-s_4109098741.png "/>

Installing the SVN client software on Win7

650) this.width=650; "Width=" 526 "height=" 413 "title=" 2017-09-28_104048.png "style=" WIDTH:371PX;HEIGHT:316PX; "alt=" Wkiom1nmyhdjtolqaac9r0au_ba711.png-wh_50 "src=" https://s4.51cto.com/wyfs02/M01/07/9A/wKiom1nMYhDjTOlQAAC9R0AU_ Ba711.png-wh_500x0-wm_3-wmp_4-s_54767509.png "/>

To open the software:


650) this.width=650; "Width=" 526 "height=" 522 "title=" 2017-09-28_104100.png "style=" width:488px;height:345px; "alt=" Wkiol1nmyekq1cfdaaa850-kdyy229.png-wh_50 "src=" https://s4.51cto.com/wyfs02/M00/A6/4C/ Wkiol1nmyekq1cfdaaa850-kdyy229.png-wh_500x0-wm_3-wmp_4-s_4143443084.png "/>

Enter the SVN server address

650) this.width=650; "title=" 2017-09-28_104112.png "alt=" wkiom1nmyjecgaukaaat-ed5z34957.png-wh_50 "src=" https:// S3.51cto.com/wyfs02/m02/07/9a/wkiom1nmyjecgaukaaat-ed5z34957.png-wh_500x0-wm_3-wmp_4-s_772498940.png "/>

650) this.width=650; "title=" 2017-09-28_104219.png "alt=" wkiom1nmykorlmjaaabvveql8-e990.png-wh_50 "src=" https:// S1.51cto.com/wyfs02/m01/07/9a/wkiom1nmykorlmjaaabvveql8-e990.png-wh_500x0-wm_3-wmp_4-s_948431759.png "/>

Make a Web page with Notepad on Win7 test1.html

650) this.width=650; "title=" 2017-09-28_104454.png "alt=" wkiol1nmyicwexiaaaapeyoaiea283.png-wh_50 "src=" https:// S2.51cto.com/wyfs02/m02/a6/4c/wkiol1nmyicwexiaaaapeyoaiea283.png-wh_500x0-wm_3-wmp_4-s_2006466701.png "/>


and drag it to the webphp folder

650) this.width=650; "title=" 2017-09-28_104523.png "alt=" wkiol1nmyjvsdmxeaab9s3qmqzy455.png-wh_50 "src=" https:// S3.51cto.com/wyfs02/m00/a6/4c/wkiol1nmyjvsdmxeaab9s3qmqzy455.png-wh_500x0-wm_3-wmp_4-s_3745440803.png "/>

Synchronizing on an nginx server

650) this.width=650; "title=" 2017-09-28_104600.png "alt=" wkiom1nmyp_g_s6waae6n8n95oy979.png-wh_50 "src=" https:// S5.51cto.com/wyfs02/m01/07/9a/wkiom1nmyp_g_s6waae6n8n95oy979.png-wh_500x0-wm_3-wmp_4-s_1775716089.png "/>

Synchronizing on a PHP server

650) this.width=650; "title=" 2017-09-28_104647.png "alt=" wkiom1nmytjgqa2paafebtqvkmo433.png-wh_50 "src=" https:// S5.51cto.com/wyfs02/m00/07/9a/wkiom1nmytjgqa2paafebtqvkmo433.png-wh_500x0-wm_3-wmp_4-s_414735637.png "/>

As you can see, it has been synchronized from SVN server to Nginx and PHP server


Iv. deployment of Nginx server 192.168.0.10
1. Installing Nginx Server

650) this.width=650; "title=" 2017-09-28_104735.png "alt=" wkiom1nmywcs1to7aaa8adwtfx0462.png-wh_50 "src=" https:// S3.51cto.com/wyfs02/m02/07/9a/wkiom1nmywcs1to7aaa8adwtfx0462.png-wh_500x0-wm_3-wmp_4-s_3147022287.png "/>

650) this.width=650; "title=" 2017-09-28_104830.png "alt=" wkiol1nmy7tgs0hwaadxtfoztoe859.png-wh_50 "src=" https:// S2.51cto.com/wyfs02/m00/a6/4c/wkiol1nmy7tgs0hwaadxtfoztoe859.png-wh_500x0-wm_3-wmp_4-s_3044723418.png "/>

650) this.width=650; "title=" 2017-09-28_104858.png "alt=" wkiol1nmy7_jtosfaaau8ajfe5m355.png-wh_50 "src=" https:// S2.51cto.com/wyfs02/m01/a6/4c/wkiol1nmy7_jtosfaaau8ajfe5m355.png-wh_500x0-wm_3-wmp_4-s_1533495865.png "/>

2. Modify Nginx Configuration
1) Configure the FastCGI access interface for the back-end PHP Program
Vim/usr/local/nginx/conf/nginx.conf

or yum install vim/usr/local/nginx/cond/defautlt.conf

650) this.width=650; "title=" 2017-09-28_105241.png "alt=" wkiom1nmzdcs3_akaabo6geozvy232.png-wh_50 "src=" https:// S2.51cto.com/wyfs02/m00/07/9a/wkiom1nmzdcs3_akaabo6geozvy232.png-wh_500x0-wm_3-wmp_4-s_3716674214.png "/>

650) this.width=650; "title=" 2017-09-28_105321.png "alt=" wkiom1nmzfyrfkuqaadnin0ldxk657.png-wh_50 "src=" https:// S5.51cto.com/wyfs02/m01/07/9a/wkiom1nmzfyrfkuqaadnin0ldxk657.png-wh_500x0-wm_3-wmp_4-s_3867867691.png "/>



2) Optimize and open the service

650) this.width=650; "title=" 2017-09-28_105401.png "alt=" wkiol1nmzetbssixaacvonhpzxu938.png-wh_50 "src=" https:// S4.51cto.com/wyfs02/m00/a6/4c/wkiol1nmzetbssixaacvonhpzxu938.png-wh_500x0-wm_3-wmp_4-s_2313712584.png "/>

V. Deployment of PHP Server 192.168.0.12
1. Install PHP
1) Install the support package

650) this.width=650; "title=" 2017-09-28_105450.png "src=" https://s2.51cto.com/wyfs02/M00/A6/4C/ Wkiol1nmzkixn7ncaadjhn4poic194.png-wh_500x0-wm_3-wmp_4-s_2949951486.png "alt=" Wkiol1nmzkixn7ncaadjhn4poic194.png-wh_50 "/>


2) Create a user


3) Copy the MySQL module to/usr/lib (because PHP defaults to/usr/lib search libmysqlclient.so)


4) Compile and install PHP

650) this.width=650; "title=" 2017-09-28_105636.png "src=" https://s4.51cto.com/wyfs02/M01/07/9A/ Wkiom1nmzr7tv5-xaadkiys0y1g669.png-wh_500x0-wm_3-wmp_4-s_3216809905.png "alt=" Wkiom1nmzr7tv5-xaadkiys0y1g669.png-wh_50 "/>

650) this.width=650; "title=" 2017-09-28_105740.png "src=" https://s4.51cto.com/wyfs02/M00/07/9A/wKiom1nMZWqS_ Jidaabf3c6fef4497.png-wh_500x0-wm_3-wmp_4-s_492439555.png "alt=" Wkiom1nmzwqs_jidaabf3c6fef4497.png-wh_50 "/>

650) this.width=650; "title=" 2017-09-28_105832.png "src=" https://s5.51cto.com/wyfs02/M01/07/9A/ Wkiom1nmzzgsrma6aabhef3j1ma148.png-wh_500x0-wm_3-wmp_4-s_1739550017.png "alt=" Wkiom1nmzzgsrma6aabhef3j1ma148.png-wh_50 "/>

650) this.width=650; "title=" 2017-09-28_105909.png "src=" https://s3.51cto.com/wyfs02/M02/A6/4C/ Wkiol1nmzxxc3poyaabz9ofeobu491.png-wh_500x0-wm_3-wmp_4-s_692247512.png "alt=" Wkiol1nmzxxc3poyaabz9ofeobu491.png-wh_50 "/>

3. Start PHP-FPM

650) this.width=650; "title=" 2017-09-28_105952.png "src=" https://s4.51cto.com/wyfs02/M01/07/9A/ Wkiom1nmzegsd9tkaabm8cv-cn0884.png-wh_500x0-wm_3-wmp_4-s_837533050.png "alt=" Wkiom1nmzegsd9tkaabm8cv-cn0884.png-wh_50 "/>


4. Create a website home directory and write a PHP test page

650) this.width=650; "title=" 2017-09-28_110034.png "src=" https://s5.51cto.com/wyfs02/M01/A6/4C/wKioL1nMZcrz_ N9zaaaohnxaz5o423.png-wh_500x0-wm_3-wmp_4-s_483889113.png "alt=" Wkiol1nmzcrz_n9zaaaohnxaz5o423.png-wh_50 "/>

5. Visit the test page

650) this.width=650; "title=" 2017-09-28_110108.png "src=" https://s4.51cto.com/wyfs02/M00/A6/4C/ Wkiol1nmze3d3vq4aackmimk678929.png-wh_500x0-wm_3-wmp_4-s_156973217.png "alt=" Wkiol1nmze3d3vq4aackmimk678929.png-wh_50 "/>

6, then in the Nginx website home directory to make static Web page index.html

650) this.width=650; "title=" 2017-09-28_110215.png "src=" https://s4.51cto.com/wyfs02/M02/A6/4C/ Wkiol1nmzjijw99oaadjkbpiyo0717.png-wh_500x0-wm_3-wmp_4-s_143090188.png "alt=" Wkiol1nmzjijw99oaadjkbpiyo0717.png-wh_50 "/>


The static webpage is handled by Nginx server, and the dynamic webpage is processed by PHP server, which realizes the separation of motion and movement.

VI. deployment of MySQL server
Installation steps are slightly (exactly the same as the previous installation)
Note: If you are deploying a Web site, you need to create a database on the MySQL server and authorize
Create Database xxx
Grant all privileges the xxx.* to ' php ' @ ' 192.168.0.% ' identified by ' 123456 '


Seven, take the Discuz forum as an example, deployed on the platform, and finally able to browse
Procedure (refer to the previous document)

Note: Usually Web site developers to modify the Web page generally operating on the Windows system, modified after the completion of the SVN server passed to Nginx and PHP.




This article from "Li Shilong" blog, declined reprint!

Deploy social networking sites

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.