I originally wanted to configure a virtual host, but found that the apache version was 2.4. I had never used it before, and I didn’t know how to configure a virtual host. I tried a lot of methods on Baidu to no avail.
After I configured the virtual host, I kept accessing the root directory, which was not the result I wanted.
Website root directory:/var/www/html/
The directory I need to access:/var/www/html/web/tp5/public
Every time When I visit demo1.com, I always go to /var/www/html
and I have set up many methods to no avail!
----------My process is as follows-----
Server version: Apache/2.4.25 (Debian)
In When configuring the virtual host, I modified the configuration of /etc/hosts
127.0.0.1 www.demo1.com
and then opened vhost at the bottom of /etc/apache2/apache2.conf .
Finally, a new xx.conf file was created under /etc/apache2/sites-enabled/, with the following content:
<VirtualHost *:80>
ServerName www .demo1.com
ServerAdmin www.demo1.com
DocumentRoot "/var/www/html/web/tp5/public/"
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
21312231kjljkllkj
a is
To add, my apache2.4 does not have an httpd.conf file at all!