Transferred from: http://blog.csdn.net/hursing/article/details/18730813
Apache originally refers to the HTTP server program, and later became the name of the program's organization, so the original program name is HTTPD, after the 2.0 version is called Apache2. Currently on Windows also called httpd, on the Debian/ubuntu/linux Mint series of Linux, the program name is Apache2. So the online said httpd information, to apache2 is partially applicable. The official website itself is also used httpd, can be understood as httpd is the product name, apache2 executable program name.
With sudo apt-get install apache2 can be installed, my Linux Mint is 2.2 version, UBUNTU13 is 2.4 version, there is a bit different. The official guidance document says upgrade from 2.2 to 2.4 what to do. Http://httpd.apache.org/docs/2.4/upgrading.html. The most direct for users is that the number of modules and names are different, the configuration file location is different.
Change the site root directory to the user partition, you can avoid the modification of files to root permissions. Method:
Version 2.2:
/etc/apache2/sites-enabled/default Modify the DocumentRoot and modify the directory tag that corresponds to the original path (the default is/var/www), which is changed to two places. DocumentRoot the end of the Add/, directory tag to add/.
Version 2.4:
/etc/apache2/sites-enabled/000-default.conf Modify DocumentRoot,
/etc/apache2/apache2.conf Modify the corresponding directory label
(The configuration file name under the two versions of sites-enabled may be different from the example here, each distribution will have its own name)
After modifying any settings, use the command sudo service apache2 Restart to restart the services. Reprint Please specify source:http://blog.csdn.net/hursing
/etc/apache2/envvars is the Apache program's parameter configuration file, including the log path, the user name used by the program, and so on. The default log location:/var/log/apache2/has error logs Error.log and access log access.log. These configurations will be export, and the service apache2 will source Envvars files before running. If you run apache2 manually, you should first source, otherwise you will be reported that some parameters are not set.
Because Apache2 is under/usr/bin/, the command line can use the apache2 command under any path. Apache2-h will list the available commands. Useful for:
-V View version
-V View compile-time settings
-L View modules integrated at compile time
-L View available configuration file directives
-T checks all configuration files for syntax errors
/etc/apache2/mods-available/indicates the available modules, the load suffix holds the path to the module, and the Conf suffix indicates the configuration of the module.
/etc/apache2/mods-enabled/represents the Enabled module, and the master profile apache2.conf references all files to this directory. This directory is full of soft links, can be seen ls-l. The corresponding module is enabled when the file under/etc/apache2/mods-available/is soft-linked to/etc/apache2/mods-enabled/.
The Ifmodule XXX tag in the configuration file indicates that the XXX module is enabled before adding the parameters inside
Apache2 has a variety of concurrent processing models MPM, you can view http://httpd.apache.org/docs/current/mpm.html for more information. The default is the Perfork model, each concurrent processor in a separate process, its configuration parameters directly affect the performance of concurrent processing.
Version 2.2:
Open/etc/apache2/apache2.conf, find <ifmodule mpm_prefork_module> tags
Startservers How many server processes are started when you start a program
Minspareservers minimum number of idle servers
Maxspareservers Maximum number of idle servers
Maxrequestsperchild the maximum number of requests per server to accept. Exits when it is reached, which avoids memory leaks. Set to 0 is not limited.
Version 2.4:
Modify/etc/apache2/mods-enabled/mpm_perfork.conf, more than 2.2 one parameter. Maxrequestworkers, the maximum number of servers. If this number wants to fill more than 256, then add a parameter maxclients xxx before. Http://httpd.apache.org/docs/current/mod/mpm_common.html has more introductions.
The above can be ps-ef by command | grep apache2 | Wc-l knows that there are currently several processes running. (actually for that number-2, because the command itself and the service master process are counted)
The parameters inside the apache2.conf are core module, which are 4 commonly used:
Timeout time-out
KeepAlive on/Off KeepAlive
Maxkeepaliverequests Maximum number of keepalive connections
KeepAliveTimeout Maximum keepalive time, timeout will close connection
Introduction to Linux Apache2 configuration