K
K
kashcheev2020-06-20 17:32:24
linux
kashcheev, 2020-06-20 17:32:24

How to specify a root for a project outside the apache2 global root?

mkdir /home/test/projects/Site2
nano /home/test/projects/Site2/index.html

sudo chmod -R 755 /home/test/projects
sudo chown -R test:test /home/test/projects

sudo cp -P /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/Site2.conf
sudo nano /etc/apache2/sites-available/Site2.conf


<VirtualHost *:8080>
        ServerName Site2.local
        ServerAdmin [email protected]
        DocumentRoot /home/test/projects/Site2

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>


sudo nano /etc/apache2/ports.conf


Listen 80
Listen 8080


sudo nano /etc/apache2/apache2.conf


<Directory /var/www/>
        Options Indexes FollowSymLinks
        AllowOverride None
        Require all granted
</Directory>
<Directory /home/test/projects/Site2>
    Options Indexes FollowSymLinks Includes ExecCGI
    AllowOverride All
    Require all granted
</Directory>


sudo a2ensite Site2.conf
sudo service apache2 restart


5eee1bec7fabf163757712.png
default.

Help, comrades, how to appease the monster?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
G
galaxy, 2020-06-20
@kashcheev

You have a virtual host only on port 8080

S
Saboteur, 2020-06-20
@saboteur_kiev

there is no global root.
There is just a default site.
Make yourself another virtual host and specify the domain and root for it in it.
Or port.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question