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 Tag
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.