Tutorial Background:
It usually takes the following three steps to compile and install the program source code:./configure à make install
Step 1: Execute the configure script in the source code path
The purpose of this step is: a. Check whether the compilation environment is complete; B. Use the configure script option to allow you to customize the compilation configuration, such as -- prefix = PATH to specify the installation PATH of the program.
Step 2: make command # automatically execute Compilation
Step 3: make install command # Put the compiled program in the specified path or default path
Purpose:
Install Apache through source code compilation and enable this service. Finally, test whether the web service is enabled.
Lab environment:
VmwareWorkstation 9, CentOS 6.4,httpd-2.4.7.tar.gz
Tutorial steps:
1. Download the Apache main package httpd.
(Official http://httpd.apache.org or other image download site)
2. decompress the source program and enter the source program directory.
Files such as INSTALL and README are usually stored in the source program directory. You can check these files before installation. For example, the INSTALL file records the installation steps of this program, tells the complete compilation Installation Steps Reference URL: http://httpd.apache.org/docs/2.4/install.html
3. Run the configure script to check the compiling environment.
The normal execution ends. No error information is available.
4. Compile automatically
[Root @ localhost httpd-2.4.7] # make
5. Install compiled programs
[Root @ localhost httpd-2.4.7] # make install
Installed in the/usr/local/apache2/bin directory by default
6. Enable the Apache service.
[Root @ localhost httpd-2.4.7] #/usr/local/apache2/bin/apachectl start
7. Test successful
The path of this web page is usually in PREFIX/htdocs /.
Problems encountered in the experiment:
1. Q: When the configure script is executed, the system exits abnormally and reports the following error: configure: error: APR not found. Please read the documentation.
A: view the Apache compilation and installation instructions (http://httpd.apache.org/docs/2.4/install.html), where Requirements indicates that the system needs to install APR and APR-Util before installing Apache. Download the APR and APR-Until source packages and decompress them to the./srclib/apr and./srclib/apr-util directories under the Apache source program directory. Execute the configure script again. (You can also run the configure script after compiling and installing the source package of APR and APR-Util respectively)
2, Q: Execute configure script, abnormal exit, error message: configure: error: pcre-config for libpcre not found. PCRE isrequired and availbe from http://pcre.org/
A: Likewise, download the pcre source program package and compile and install it.
3. Q: After compiling and installing Apache and enabling the Service, enter http: // locahost in the browser to verify the success, but the http: // local IP address cannot be accessed.
A: You can use the serviceiptables stop command to temporarily disable the firewall.
(However, even if you start iptables or even apachectl stop again, this webpage can still be accessed. For example, if you access the cache, how can you clear it ?)
If you have the default firewall rules enabledyou will not be able to access Apache without some additional configuration. the simplest solution is to run the system-config-firewall tool and check the 'www (HTTP) 'checkbox.
You can also disable the firewalltemporarily by running:
Service iptables stop
Apache-multi-site log analysis
Install Apache that supports SSL in Ubuntu 13.10
Disguise Apache to prevent Web Server intrusion
Compiling and installing the Apache Python module mod_wsgi
Enterprise Shell script analysis and Apache Log cutting practices