Basic introduction to Apache services

1. Apache installation (1) Install Apache service: sudo apt-get install apache2  (2) Install additional functions of apache: sudo apt-get install apache2-utils  2. The basic directory of Apache  (1) /etc/apache2  (2 )/etc/init.d  (3)/var/www /usr/share  (4)/var/log/apache2  (5)/usr/sbin  3, Apache basic commands  (1) apache2  (2) /etc/ init.d/apache2  (3) htpasswd  (4) a2[en/dis][mod/conf/sites]   4. The basic structure  of the Apache configuration file  is as follows: /etc/apache2/  |-- apache2.conf  | `-- ports.conf  |-- mods-enabled  | |-- *.load  | `-- *.conf  |-- conf-enabled  | `-- *.conf  |-- sites-enabled  | `-- *.conf   

























5. Apache service configuration (1) The configuration function of virtual host  : It can run multiple websites on one machine (for example: www.company1.com and www.company2.com ). A virtual host can be "IP-based" if each website has a different IP address, or "hostname-based" if there is only one IP address. Once implemented, it is transparent to the end user. (2) Main configuration file: apache2.conf will load the contents of other configuration files to the main configuration file when the service is running. The configuration file is not case-sensitive. (3) Configuration instruction format  ① Direct instruction:  require all granted  ② Block instruction:  <block-directive option>  directive option  </block-directive>   (4) Access control configuration  Log in and browse permissions: order  Enter username Access: Auth  allows overwriting Parameter: allowoverride  (5) Directory block access  Alias ​​/backuppc /usr/share/backuppc/cgi-bin/  <Directory /usr/share/backuppc/cgi-bin/>      AllowOverride None      Allow from all   






















    Options ExecCGI FollowSymlinks 
    AddHandler cgi-script .cgi 
    DirectoryIndex index.cgi 
    AuthUserFile /etc/backuppc/htpasswd 
    AuthType basic 
    AuthName "BackupPC admin" 
    require valid-user 
</Directory> 
①options indicates that the apache service enters this directory and can perform operations: indexes, followsymlinks, execcgi, includes, multiviews; 
②alias means that accessing localhost/backuppc is equivalent to accessing localhost/usr/share/backuppc/cgi-bin/. 
(6) Other configuration file directories 
① conf-enable / conf-avaliable 
stores some additional files of some main configuration files, or some local configuration files of the user; 
② mods-enable / mods-avaliable  
directory contains some .conf and .load files, which are configuration files that can be used in the system to load various modules. 
Under the mods-enabled directory are symbolic links to these configuration files. The system can load modules only from the configuration files in the mods-available directory where a symlink is created in this directory. 
The system also provides two commands (provided by the apache2-common package) for maintaining these symbolic links - a2enmod and a2dismod. 
The command format is: a2enmod [module] or a2dismod [module] . 
③The sites-enable/sites-avaliable 
directory is the configuration file of the configured site. 
The sites-enabled directory contains symbolic links pointing to these configuration files. The system uses these symbolic links to use symbolic links with a number prefix in the sites-enabled directory, such as 000-default,. 
This number is used to determine the boot order, the lower the number, the higher the boot priority. The system provides two commands a2ensite and a2dissite for maintaining these symbolic links. 
6. Build a lamp site and install lamp series software packages: sudo tasksel install lamp-server  

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325756795&siteId=291194637