LAMP configuration specification-SINA

Source: Internet
Author: User
There is no rule in the meaning of a standard, and it cannot be a square. We should be familiar with this and analyze our previous server usage situations. The common phenomenon is that we are very casual about the use of servers, and there is no specification for guidance and constraints, administrators and developers can configure and use servers at will, which causes many problems: difficulties in system maintenance and management. Significance of Standardization
  • No rules.This should not be unfamiliar. We have analyzed our previous server usage situations. The common phenomenon is thatThe usage is very random, and there is no specification for guidance and constraints, administrators and developers can basically configure at willUsing the server causes many problems:
  • The difficulty and cost of system maintenance management are getting higher and higher.
  • The server configuration cannot be unified, and the Development Environment configuration cannot be unified.
  • After the system department completes the Basic installation of the server, the process of being handed over to the Application Department is completely uncontrolled.
  • Developers can configure the server development environment at will, causing security risks and increasing the difficulty and cost of system maintenance and management.
  • Because the development environment is not uniform, it adds unnecessary trouble for program development, porting, installation, and other work.
  • Due to the inconsistent development environment, it also makes it difficult for developers to familiarize themselves with the server environment and even reconfigure the server.Therefore, we hope that the System Department can take the lead and discuss with the majority of developers to develop and gradually improve a comparison.General development environment configuration specifications that adapt to most development needs, after the System Department Completes the Basic installation of the system,Install and configure the development environment according to the specifications, and you can directly use it if you want to deliver it to the server of the Application Department..Because it is the first draft, the specifications may not be reasonable, but there are always better standards than there are no standards. We can go through practice and discussion.Constantly improve specifications.
Directory layout and file naming rules
  • Directory naming is mainly used for unified maintenance and convenient use. You can use the following methodsTo achieve unified directory layout and search:
  • Mount directly creates the corresponding mount loading point, such as/sinasrv/www
  • Mount -- bind parameter. This method can be used to mount a directory to another directory, for example:
    • Mount -- bind/sinasrv/www/htdocs/data1/apache/htdocsMount -- bind/sinasrv/www/logs/data2/apache/logsMount -- bind/sinasrv/www/mMcAche/data2/mmcache
  • Symbolic Link (this is the most commonly used)
Common directory layout specifications
  • The benefit of clearly classifying directories is that we can configure different access permissions for different types of directories,To achieve high security control.
  • Software Installation root directory
    • /Usr/local/sinasrv
  • Apache installation directory
    • /Usr/local/sinasrv/apache
  • MySQL installation directory
    • /Usr/local/sinasrv/mysql
  • Data root directory name
    • /Sinasrv
  • Apache data root directory
    • /Sinasrv/www
  • MySQL DATA root directory
    • Data root directory prefix + "mysql" Application category directory name/Sinasrv/mysql
  • Directory Name of Apache Virtual Host documents, programs, and data
    • Apache file directory
      • Root directory + document directory + virtual host domain name/Sinasrv/www/htdocs/SuRvey.news.sina.com.cn
    • Directory of the Apache cgi program
      • Root directory + document directory + virtual host domain name/Sinasrv/www/cgi-bin/survey.news.sina.com.cn
    • Apache program data directory
      • Root directory + data directory + virtual host domain name/Sinasrv/www/data/survey.news.sina.com.cn
    • Apache program cache directory
      • Root directory + cache directory + Virtual Host Name/Sinasrv/www/cache/survey.news.sina.com.cn
    • Apache nfs-based Shared data directory
      • /Sinasrv/www/ndata/survey.news.sina.com.cn
    • Apache nfs-based shared cache directory
      • /Sinasrv/www/NcAche/survey.news.sina.com.cn
    • Apache nfs-based shared document directory
      • /Sinasrv/www/nhtdocs/survey.news.sina.com.cn
  • Turck MMCache program cache directory
    • /Sinasrv/www/mmcache
  • PHPSession Directory
    • /Sinasrv/www/PhpSession
  • User File Upload directory
    • /Sinasrv/www/userupload
  • MySQL data directory name
    • MySQL DATA root directory + "mysql" + open port number/Sinasrv/mysql/mysql3310
    Note: As shown in the preceding configuration of the VM, the directories for specific requirements of the VM are defined under each specific directory, such as data, is the heel of the data directory of all virtual hosts. Each Virtual Machine host has a domain name to create its own directory. The advantage of this operation is that you can control data permissions without creating the data directory under the root directory of each VM host.

Naming rules for common files
  • Name the log directory and log file of the Apache Virtual Host
    • Log root directory
      • /Sinasrv/www/logs
    • Error Log
      • Log root directory + error log directory + virtual host domain name + "-error_log" suffix/Sinasrv/www/logs/error/survey.news.sina.com.cn-error_log
    • Access log
      • Log root directory + error log directory + virtual host domain name + "-access_log" suffix/Sinasrv/www/logs/access/survey.news.sina.com.cn-access_log
    • Archive logs
      • Log root directory + archive log directory + date directory + VM domain name + Internet IP address + "_ cn" suffix/Sinasrv/www/logs/archive/051231/survey.news.sina.com.cn_10.44.6.24_cn.gz
  • MySQL configuration file name
    • MySQL data directory name + "my" + open port number + ". cnf/Sinasrv/mysql/mysql3310/my3310.cnf
  • MySQL socket file name
    • /Tmp directory name + "mysql" + port number + ". sock"/Tmp/mysql3310.sock
  • RSyncConfiguration File
    • /Etc/rsynCd. Conf
  • Rsync authentication configuration file
    • /Etc/rsyncd. secrets

Other naming rules
  • MySQL database naming rules
    • Use domain name or project nameFor example, if the domain name is news.survey.sina.com.cn, the database name is news_survey.For example, if the project name is generic test project, the Library name is generaltest.
  • MySQL read/write account naming rules
    • By default, only one account with the same name as the database is configured with all operation permissions for the database.
  • MySQL read-only account naming rules
    • By default, only one read-only account is configured, and all data in the database can be accessed. The name is:Database Name + "_ r" suffix
  • MySQL server-IdNaming rules
    • Use the Internet IP address of the server followed by two + MySQL listening port numbers. If the IP address is less than three digits, add 0,For example, 10.44.6.17, port 3306Servers-id = 0060173306
  • Rsync Module name
    • By default, the virtual host domain name is the module name.Example: news.survey.sina.com.cn

Local disk usage and directory name
  • Assume that the server has three hard disks, and the system disk does not need to store data. The first database disk is loaded in/data1.
    • Directory, the second data disk is loaded under the/data2 directory.
    • /Create the following directory for the data1 Disk:
      • /Data1/sinasrv/www/htdocs
      • /Data1/sinasrv/www/data
      • /Data1/sinasrv/www/cgi-bin
      • /Data1/sinasrv/mysql/
    • /Create the following directory for data2 Disk
      • /Data2/sinasrv/www/logs
      • /Data2/sinasrv/www/cache
      • /Data2/sinasrv/www/mmcache
      • /Data2/sinasrv/www/phpsession
      • /Data2/sinasrv/www/userupload
      • /Data2/sinasrv/mysql/
  • For a server with a data disk, load the data disk to the/data1 directory, and all the directories are created in
    • /Data1/sinasrv directory.
  • For servers with three data disks, attach the third data disk to the/data3 directory,
    • Create the/data3/sinasrv directory and use it later as needed.
  • The preceding directories are symbolic to the/sinasrv/www directory. If the directory is in the chroot environment,
    • Mount -- bind to the/sinasrv/www directory.
Related Article

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.