Apache originally referred to the http server program and later became the Organization Name of the program. Therefore, the original program name was set to httpd, which was later called apache2 after version 2.0. Currently, it is also called httpd on windows. In debian/ubuntu/linux mint linux, the program name is apache2. Therefore, the httpd information on the internet is partly applicable to apache2. The official website also uses the httpd statement. It can be understood that httpd is the product name and the executable program name of apache2.
Use sudo apt-get install apache2 to install it. My linux mint is installed with version 2.2 and Ubuntu13 is installed with version 2.4. There is a difference between the two. There are official guidance documents on what to do from 2.2 to 2.4. Http://httpd.apache.org/docs/2.4/upgrading.html. For users, the most direct difference is that the number of modules and names are different, and the configuration file location is different.
Change the root directory of the website to the user partition to avoid the root permission required for modifying files. Method:
/Etc/apache2/sites-available/default modify DocumentRoot and modify the Directory label with the original path (/var/www by default. Do not add/at the end of DocumentRoot, and add/to Directory labels /.
/Etc/apache2/sites-available/000-default.conf modify DocumentRoot,
/Etc/apache2/apache2.conf modify the corresponding Directory label
After modifying any settings, run the sudo service apache2 restart command to restart the service. Reprinted please indicate the source: http://blog.csdn.net/hursing
/Etc/apache2/envvars is the parameter configuration file of the apache program, including the log Path and the user name used by the program. Default log location:/var/log/apache2/contains error. log and access. log. These configurations will be export, and service apache2 will run the source envvars file before running. If you manually run apache2, you should first run source. Otherwise, some parameters are not set.
Because apache2 is under/usr/bin/, the command line can use The apache2 command in any path. Apache2-h lists available commands. Useful:
-V view version
-V view the compilation settings
-L view the integrated modules during compilation
-L view available configuration file commands
-T check all configuration files for syntax errors
/Etc/apache2/mod-available/indicates available modules. The load suffix stores the module path, and the conf suffix indicates the module configuration.
/Etc/apache2/mod-enabled/indicates the enabled modules. The main configuration file apache2.conf references all files in this directory. The directory is full of soft links, which can be viewed by ls-l. Soft link the file in/etc/apache2/mod-available/to/etc/apache2/mod-enabled/to enable the corresponding module.
In the configuration file, the IfModule xxx tag indicates that the parameter is added only when the xxx module is enabled.
Apache2 has multiple concurrent processing models (MPM). For details, see http://httpd.apache.org/docs/current/mpm.html. The default value is the ipvk model. Each concurrent processor is in an independent process. Its configuration parameters directly affect the performance of concurrent processing.
Open/etc/apache2/apache2.conf and find the <IfModule mpm_prefork_module> label.
How many server processes are started when StartServers starts the program
MinSpareServers minimum number of idle servers
MaxSpareServers maximum number of idle servers
MaxRequestsPerChild: Maximum number of requests per server. When this parameter is reached, the system exits to avoid Memory leakage. If it is set to 0, it is not limited.
Modify/etc/apache2/mod-enabled/mpm_javask.conf, with one parameter greater than 2.2. MaxRequestWorkers: the maximum number of servers. If you want to enter more than 256, you must add the MaxClients xxx parameter. For more information, see http://httpd.apache.org/docs/current/mod/mpm_common.html.
You can run the command ps-ef | grep apache2 | wc-l to know that several processes are currently running. (The actual number is-2, because the command itself and the main service process will be counted)
The parameters in apache2.conf belong to the core module, which are commonly used:
KeepAlive On/Off start or stop KeepAlive
Maximum number of KeepAlive connections in MaxKeepAliveRequests
Maximum KeepAlive time of KeepAliveTimeout. connection will be closed upon timeout.