P
P
Peppa Pig2016-09-03 16:35:23
Apache HTTP Server
Peppa Pig, 2016-09-03 16:35:23

How to host a site in the url subdirectory on a local server?

There is a server on ubunt in the LAN, it has the name servername and there is an apache on the server, if you go to servername , you can see that apache is running.
I need the virtual hosts to be accessible by url servername/sitename.
Here is the code in site-available that did not lead to this:

<VirtualHost *:80>
    ServerName  servername/sitename
    ServerAlias /sitename
    DocumentRoot /var/www/sitename
    <Directory /var/www/sitename>
        Options Indexes FollowSymlinks
        AllowOverride All
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

If you do it like this, then, as expected, a site will pop up on the servername .
<VirtualHost *:80>
    ServerName  servername
    DocumentRoot /var/www/sitename
    <Directory /var/www/sitename>
        Options Indexes FollowSymlinks
        AllowOverride All
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

CHADNT?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Peppa Pig, 2016-09-03
@qbudha

Here's what I needed:

<VirtualHost *:80>
    ServerName servername
    Alias "/sitename" "/var/www/sitename"
    DocumentRoot /var/www/
    <Directory /var/www/sitename>
        Options Indexes FollowSymlinks
        AllowOverride All
        Allow from all
        Require all granted
    </Directory>
</VirtualHost>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question