In fact, my ultimate goal is to run PHP at the same time on one of the host's Apache (see the situation and choose a framework to use) and Python (Django Framework, old friends). So my plan is to install the apache+php first, and then I'll put Django on this basis. After loading PHP, I need to configure Apache to see how to get Apache to offload PHP and Python.
The configuration file for Apache in Linux is in the/etc/apache2 directory with a apache2.conf and sites-available/000-default.conf in it. Looking at the contents of these two files, it is almost certain that the files I need to change are the two (unlike Windows, Apache has only httpd.conf this profile). Further understand that the sites-available directory of conf corresponds to a number of sites, and each conf inside can also set different virtualhost, can be used to achieve the "shunt" I want. On the other hand, what is the role of the Conf link under the sites-enabled directory? In fact, there is a corresponding link in the sites-enabled, which means that the link corresponds to sites-available in the Conf is enabled. Site-enabled already have the link of 000-default.conf, so don't care so much, we modify site-available in the 000-default.conf on the line.
Don't talk nonsense. The most useful reference: Apache document VirtualHost Sample https://httpd.apache.org/docs/2.4/vhosts/examples.html
According to my situation, I need to run a number of sites on an IP, and I do not have multiple domain names, then through the different ports to achieve. This is the 4th method "Running different sites on different ports":
Listen
Listen 8000
<virtualhost *:80>
documentroot/var/www/php
</VirtualHost>
<virtualhost *:8000>
Documentroot/var/www/django
</VirtualHost>
The simplest configuration is the one above, and I added a bit of log-related stuff myself:
Listen
Listen 8000
<virtualhost *:80>
ServerAdmin abc@123.com
documentroot/var/www/php
errorlog ${apache_log_dir}/php-error.log
Customlog ${apache_log_dir}/php-access.log
</VirtualHost>
<virtualhost *:8000>
ServerAdmin abc@123.com
Documentroot/var/www/django
errorlog ${apache_log_dir}/django-error.log
Customlog ${apache_log_dir}/django-access.log
</VirtualHost>
Don't send emails. ${apache_log_dir} is actually/var/log/apache2. Restart Apache.
Now, create a index.php under/var/www/php and/var/www/django, and write some PHP code. Access to 127.0.0.1:80 and 127.0.0.1:8000 are OK.
The next step is to fix the Django installation, and the rest of the VirtualHost configuration is slow.