LAMP architecture-my work experiences

Source: Internet
Author: User
Tags mysql index

 

Figure-LAMP

At the end of, I joined an entrepreneurial small company, engaged in technical jobs for more than a year. At the end of 10, I had the honor to join a large Internet company. After my life-long career events, I would like to sum up my thoughts and thoughts when I was idle, so with this series of articles, the technology is not refined, the style is rough, and the smile is generous. This is the first article in the series.LAMP Architecture.

To avoid ambiguity, LAMP in this series refers to Linux + Apache + MySQL + PHP. LAMP, JAVA/J2EE, And. NET are the three pillars of the current web architecture. Compared with JAVA/J2EE, LAMP has obvious advantages such as lightweight and Fast deployment. Compared with. NET, LAMP has the advantages of cross-platform, high performance and low price. If your company has limited time and a strong sense of cost control, LAMP architecture is your best choice. This series of articles focuses on the configuration optimization of LAMP components, and the optimization of applications is not covered in my discussion.

My first job was to develop server programs in a small entrepreneurial company. The company's main business is the development of SNS web games. There are also several online games. due to various reasons, the games are not very successful. However, I still learned a lot during that time. At that time, I set up the LAMP environment on the company's development server and operation server. Due to limited experience, the system was okay as long as it ran and did not consider too many performance optimizations. Later, with the increase in the number of online users, we began to make some optimizations.

There is a version question about L. At present, there are too many Unix-like versions. What version is selected as the system of our server? I chose CentOS. For free reasons, we do not consider the various Red Hat Enterprise versions. CentOS is the product of source code re-Compilation of RHEL (Red Hat Enterprise Linux), and many known bugs have been fixed on the basis of RHEL. Compared with other Linux distributions, CentOS is trustable. I have more than two years of experience using Fedora before I work. The relationship between Fedora and CentOS makes me more determined to choose CentOS.

Because it is a summary article, I do not plan to list all LAMP versions. This article does not prevent the discussion. Almost all linux versions contain LAMP, which makes it easy to install and configure the LAMP environment. The simplicity of installation leads to the mistaken assumption that these LAMP components will automatically run smoothly, which is often counterproductive. In the end, the application load exceeds the processing capacity of the backend server. Therefore, it is especially important to have full control over the configuration of LAMP, and sound monitoring mechanisms are also important because they are the only basis for your system optimization.

Generally, our servers are remotely hosted. Therefore, it is important that servers have remote management capabilities. Generally, SSHD is used. In most Linux operating systems, there is an open-ssh remote management and control service software: SSHD, SSH is a remote login tool. SSL encryption is adopted, which is more secure than traditional Telnet. At the same time, SSHD has SCP and SFTP functions, which can easily implement local to remote management and control, and remote to remote file transmission. By default, after CentOS is installed, You can remotely connect to the host through SSHD After configuring the network. For remote management, tools such as putty and SecureCRT can be used in windows, which is very convenient.

To create a high-performance web site, you must follow one of the many basic principles: use standard installation paths and configurations. From development to deployment, applications must go through three types of servers: Development Server, test server, and Operation server. If we do not use the standard installation path and configuration, it is very likely that errors will occur during the migration between these three types of servers, and various time-and labor-consuming adjustments are required to run them, it is also difficult to maintain.

On the other hand, complying with this principle will greatly facilitate your permission assignment, backup, monitoring, and other operations. At the operating system level, when installing CentOS, You need to allocate a var partition to store the log files of the web server. If you properly configure your system, var will be separated into a relatively independent file system. One of the advantages of this is: if the application suddenly writes a large amount of logs and occupies your disk space, the application will not crash. If the log file and the main code are mixed together, the consequences are severe and the application will crash. Don't forget that the log rotation mechanism may be invalid. This is important.

When considering the LAMP architecture, no one will ignore the security considerations. Here we will briefly mention SELinux. SELinux often brings you a lot of trouble due to configuration reasons. It is a bit of a pity to search for this security tool on the Internet and how to close it everywhere. In fact, as long as you carefully read this article (Click here), you will be enough to use SELinux to protect your webserver. You Need To Know That SELinux is disabled, it is not an elegant solution.

If you need sufficient security, dedicated hardware firewalls are essential. In addition, you should configure iptables. I have said on the Internet that the best-practice iptables configuration has about five pages, and I can see that the default CentOS configuration description is only about 10 lines, which is obviously insufficient. In addition, do not use the root account to run Apache. Although it is very convenient for the root user to install the software package and has no permissions, if your Apache is run by the root user, that is equivalent to entering your Apache with ulterior motives, which means that he takes over your system.

I have not had a deep understanding of the impact of the operating system, namely, the L in LAMP, on the entire LAMP architecture. I hope you will not be able to laugh at me. Please give me more advice.

Through the article, I am sure you have learned about the LAMP architecture through my experience and guidance!

  • LAMP strategy-writing of SQL statements executed by PHP
  • MySQL database structure and data export and import using LAMP
  • MySQL index based on LAMP strategy
  • LAMP quickly builds apache web Servers
  • LAMP strategy-Integration of Apache and PHP
  • Apache + SSL Howto in LAMP Environment
  • Install Apache-mysql-php in LAMP

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.