The LAMP (linux-apache-mysql-php) website architecture is currently a popular international web framework that includes: Linux operating system, Apache Web server, MySQL database, Perl, PHP or Python programming language, All components are open source software, is an internationally mature architecture framework, many popular commercial applications are to adopt this architecture, and JAVA/J2EE architecture, lamp with rich web resources, lightweight, rapid development features, Microsoft's. NET architecture, lamp has a common, cross-platform, high-performance, low-cost advantages, so lamp whether it is performance, quality or price is the preferred platform for enterprises to build websites.
This time, let us first to complete the Apache website Server Building, as the front end of the lamp architecture, Apache is a powerful and stable Web server program, the server directly to users to provide network access, send Web pages, pictures and other file content.
This installation needs to use the compilation installation package: Baidu Network disk Password: 2r7m
- First of all, we can attach the installation package to the new lamp directory in opt directory and the HTTP, Apr (support Apache Upper application cross-platform, provide the underlying interface library), apr-util three compressed packets extracted into the OPT directory:
mount.cifs //192.168.x.x/LAMP /opt/lamptar xzvf http-2.4.2.tar.gz -C /opttar xzvf apr-1.4.6.tar.gz -C /opttar xzvf apr-util-1.4.1.tar.gz -C /opt
- Move to the OPT directory and copy the APR, Apr-util recursively to the Srclib directory in httpd, and create a new directory for them to easily identify:
cp -R apr-1.4.6/ /opt/httpd-2.4.2/srclib/aprcp -R apr-util-1.4.1/ /opt/httpd-2.4.2/srclib/apr-util
- Installation of GCC, gcc-c++, make, Pcre, pcre-devel four packages using the Yum repository
(pcre: A Perl library that supports regular expressions):
yum install gcc gcc-c++ make pcre pcre-devel -y
- Move to the HTTPD home directory and configure it with configure:
cd /opt/httpd-2.4.2./configure --prefix=/usr/local/apache --enable-so --enable-rewrite --enable-mods-shared=most --with-mpm=worker --disable-cgid --disable-cgi
- The directory is the same, execute the command make and install the build installation:
make && make install
- Filter out the comment lines (#) in the script file and redirect to the ETC directory, edit the file, and insert the following line at the front of the file to execute:
-
Grep-v "#"/usr/local/apache/bin/apachectl >/ETC/INIT.D/HTTPD
Vim/etc/init.d/httpd
#在文件开头插入下面的行
#!/bin/sh
chkconfig:2345 85 15
# description:Apache is a World Wide Web server.
- At this point, we can set up the HTTPD service to boot in Init3, INIT5, and establish a soft connection for easy management:
chkconfig --level 35 httpd onln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf
- Edit the httpd.conf file and modify the configuration:
vim /etc/httpd.confListen:IPV4 #这里我们可以监听本机地址ServerName: #分别为主机名.域名
Now we can start the service!
-
Redhat6.5中服务开启关闭命令service httpd startservice httpd stop如在Redhat7.0以上版本,即为以下命令systemctl start httpd.servicesystemctl stop httpd.servicenetstat -tnl //查看监听端口主页存放路径为 /usr/local/apache/htdocs/index.html
We can use another machine in the same network segment on the LAN to access the home page, but be careful to shut down the server's firewall first.
service iptables stopsetenforce 0
Use a different host to access the home page:
Build Lamp architecture-1, manually compile and install Apache