Introduction to
LAMP
Architecture
Lamp architecture is one of the most mature application models of enterprise website, which refers to a complete set of system and related software, which can provide dynamic Web site service and its application development environment. The word lamp is an abbreviation, including: Linux operating system, Apache Web server, MySQL database server, PHP (or Perl, Python) Web programming language.
In the four constituent components of the lamp platform, each component is part of a critical application. Through the past more than 10 years of development, the compatibility between the components has been continuously improved, collaboration and stability has been enhanced, can build a very good Web application system. The main functions of each component are as follows.
l (Platform) Linux: As the basis of the lamp architecture, provides the operating system to support the Web site, with three other components to provide better stability, compatibility (AMP components also support Windows, UNIX and other platforms).
l (front desk) Apache: As the front end of the lamp architecture, it is a powerful and stable Web server program, which provides website access directly to users, sends Web pages, pictures and other file contents.
l (Backstage) MySQL: As the back end of the lamp architecture, it is a popular open source relational database system. In the Enterprise website, business system and other applications, a variety of account information, product information, customer information, business data, etc. can be stored in the MySQL database, other programs can be queried through SQL statements, change this information.
l (Intermediate connection) Php/perl/python: As the three programming languages for developing dynamic Web pages, it is responsible for interpreting dynamic Web pages and providing the development and operating environment for Web applications. PHP is a widely used, open-source, multi-purpose scripting language that can be embedded in HTML, especially for Web application development.
Preparatory work
Operating system:Linux Redhat6.5
Related packages: Link: https://pan.baidu.com/s/1yKEbLF-CR4qEtUyNx5oO_w Password: 5m85
Apache Installation Steps
1. Decompression http, Apr, apr-util (support Apache Upper application cross-platform, provide the bottom interface library, can effectively reduce the number of concurrent connections, reduce the process and reduce access congestion) package to the/OPT directory
Tar xzvf http-2.4.2.tar.gz-c/opt
Tar xzvf apr-1.4.6.tar.gz-c/opt
Tar xzvf apr-util-1.4.1.tar.gz-c/opt
2. copy Apr, apr-util package to httpd directory
Cp-r/opt APR-1.4.6/OPT/HTTPD-2.4.2/SRCLIB/APR
Cp-r/opt Apr-util-1.4.1/opt/httpd-2.4.2/srclib/apr-util
3. installation of GCC, gcc-c++, make, Pcre, pcre-devel four packs
Yum install gcc gcc-c++ make pcre pcre-devel-y
4. Enter the httpd directory to configure the installation
cd/opt/httpd-2.4.2
4.1 Configuring software modules
./configure \
--prefix=/usr/local/apache \ # Installation Path
--enable-so \ # Enable dynamic module loading
--enable-rewrite \ # Enable Web page address rewriting feature
--enable-mods-shared=most \ # load most modules dynamically
--with-mpm=worker \ # Enable worker working mode multi-processing module
--disable-cgid \ # Turn off CGI scripting support
--disable-cgi # turn off the Common Gateway Interface
4.2 Compiling and installing
Make && make install
5. filter out the comment lines (#) and copy the httpd service file to/etc/init.d/ for service management
Grep-v "#"/usr/local/apache/bin/apachectl >/ETC/INIT.D/HTTPD
6. Edit the httpd service file
Vim/etc/init.d/httpd
#在文件最前面插入以下内容
#!/bin/sh
#chkconfig: 2345 85 15
#description: Apache is a world Wide Web server.
7. Add execute permissions to the httpd file
chmod +x/etc/init.d/httpd
8. Add the HTTPD service to the system service and set the boot to init3, init5
Chkconfig--add httpd
Chkconfig--level httpd on
9. Create soft links for/etc/httpd.conf files for post-management purposes
Ln-s/usr/local/apache/conf/httpd.conf/etc/httpd.conf
Modify the configuration file httpd.conf
Vim/etc/httpd.conf
listen:ip:80 # Listen for IP address and port, modify it to your local IP address
#Listen # comment out the listening IPV6 address
ServerName: hostname. Domain name #服务器名称
directoryindex index.html # Default site file settings (default Site Directory is:/usr/local/apache/htdocs/)
turn on the httpd service and turn off the firewall .
Service httpd Start
Service Iptables Stop
Setenforce 0
Check port 80 to see if the HTTPD service has started
If the httpd service is turned on, use the browser access IP address to open the Apache home page
Lamp architecture Deployment--Compile and install Apache