view version
The old one uses httpd -v and
the new one uses apache2 -v
configuration detection
The old httpd -t
new apachectl configtest
window uses apache is httpd -t
apachectl configtest in Linux
main configuration file
The previous version of apache was httpd and now it is changed to
httpd.conf in apache2 /etc/apache2/apache2.conf window
Modify the default website root directory
For security reasons, apache2 only allows the folders under /var/www and /usr/share to be accessed. If you want to specify other directories as the root directory of the website, you need to modify the configuration
file
vim /etc/apache2/apache2.conf
Configure virtual host
/etc/apache2/sites-enabled/000-default.conf.
The Apache virtual host configuration file is stored in the /etc/apache2/sites-available directory, and the standard naming is to use the domain name to name the configuration file
ln soft link
Apache will not read the configuration files in the /etc/apache2/sites-available folder by default, you need to link them to the /etc/apache2/sites-enabled folder, use a2ensite to create a link, and activate the virtual host configuration:
sudo a2ensite custom .conf as above 000-default.conf
Detect apache configuration
The apache used by windows is the opening, closing and restarting of services in
apachectl configtest in httpd -t Linux
1. service service name stop
2. service service name start
3. service service name restart
or
1. systemctl stop service name systemctl stop apache2
2. systemctl restart service name systemctl restart apache2 systemctl reload apache
3. systemctl start service name systemctl start apache2
4 systemctl status apache2
5 systemctl enable service name boot self-start
6. systemctl disable service name shutdown Self-start
Build Apache service
1 Create a project directory mkdir -p /CustZen/www
2 Create zen.html file by redirecting www directory
3 Configure Apache
Apache will not read the configuration files in the /etc/apache2/sites-available folder by default, you need to link them to the /etc/apache2/sites-enabled folder, use a2ensite to create a link, and activate the virtual host configuration:
1 Use ln -s soft link
2 a2ensite This apache's own method does not need to consider the directory, it is written in the script
Default page index.html index.php etc.
security.conf
sudo vim /etc/apache2/conf-avalilable/security.conf
Note to restart the Apache service
systemctl reload apache2
modify default page
Note that the higher the DirectoryIndex, the higher the priority