Create a apache2 directory
Mkdir–p/usr/local/apache2
Extract the Apache source package to the Apache2 directory and compile Apache:
./configure--prefix=/usr/local/apache2/--with-included-apr--enable-so--enable-deflate=shared--enable-expires= Shared--enable-rewrite=shared--with-pcre
1. Make Compile server program
2. Make Install server program
3. /usr/local/apache2/bin/apachectl Start httpd Service
4. /USR/LOCAL/APACHE2/BIN/APACHECTL-T Syntax Detection
Change httpd boot mode-configured as System service:
1. Copy the HTTP script to the/ETC/INIT.D directory:
# CP/USR/LOCAL/APACHE2/BIN/APACHECTL/ETC/INIT.D/HTTPD
# CP/USR/LOCAL/APACHE2/BIN/APACHECTL/USR/LOCAL/BIN/HTTPD
# ln-s/ETC/INIT.D/HTTPD/ETC/RC.D/RC5.D/S61HTTPD
# ln-s/ETC/INIT.D/HTTPD/ETC/RC.D/RC4.D/S61HTTPD
# ln-s/ETC/INIT.D/HTTPD/ETC/RC.D/RC3.D/S61HTTPD
Note:/etc/rc.d/rc3.d~rc5.d inside the file is/ETC/INIT.D inside the shortcut, delete/etc/init.d directory below the file equals delete rc3.d~rc5.d shortcut
2.VI httpd
#chkconfig: 345 61 61
#description: Apache
3. Add httpd to Startup item:
Chkconfig--add httpd
4. Check if there is a httpd service:
Chkconfig--list httpd
Note:/etc/init.d/httpd Start and service httpd start differences
Service command is a function of system-v system, in fact, it is also a script, you can view/sbin/service, which defines the target directory: servicedir= "/ETC/INIT.D"
That is, when you execute service httpd start, and execute/etc/init.d/httpd start is the same, it is just a shortcut.
root directory of Apache server after source installation :
/usr/local/apache2/
Log file:
/usr/local/apache2/logs/
HTTPD Master configuration file:
/usr/local/apache2/conf/httpd.conf
HTTP Server Web root directory:
/usr/local/apache2/htdocs/
To create a virtual Web host:
cd/usr/local/apache2/htdocs/creating a virtual directory benetcom
mkdir benetcom
CD benetcom
cp/usr/local/apache2/htdocs/index.html./Create a test page
Vi index.html
cd/usr/local/apache2/conf/Adding Virtual Host configuration
Vi httpd.conf
: R extra/httpd-vhosts.conf
80>
# ServerAdmin [email protected]
DocumentRoot"/usr/local/apache2/docs/benetcom"
ServerNameWww.benet.com
# Serveralias Www.dummy-host.example.com
Errorlog "Logs/benet.com-error_log"
Customlog "Logs/benet.com-access_log" common
the Apache configuration file after installing with RPM package is specific location:
/etc/httpd/apache Service Program Root directory
/ETC/HTTPD/CONF/HTTPD.CONF Master configuration file
/var/www/html Web document default root directory
/var/log/httpd/error_log error log file
/var/log/httpd/access_log Access log files
This article is from the "Boyhack" blog, make sure to keep this source http://461205160.blog.51cto.com/274918/1731041
Apache Source Installation