Reputation: 1088
I Installed apache server on ubuntu to test my application locally.
The applications hosted on that server are all in the html folder located at the following path /var/www/html
When I write localhost, it displays the Index of the folder that are in my html file.
Let's say my application is called application01, to run it I have to write localhost/application01/src/en/index.html
to the adress bar.
I want to be able to access it witchout having to include the whole path.
Something like this:
My apache2.config file contains the following:
<Directory />
Options FollowSymLinks
AllowOverride None
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/html/>
Options Indexes FollowSymLinks
AllowOverride None
Require all granted
</Directory>
I tried to changed the Directory to /var/www/html/application01/src/
, but it didn't work.
Thank you.
Upvotes: 0
Views: 489
Reputation: 499
Leave the Apache.conf
file as it is.
Go to /etc/apache2/sites-available/
folder, Here you will see a file named 000-default.conf. This is the default site for apache.
Open the above file with nano editor using this command sudo nano /etc/apache2/sites-available/000-defualt.conf
. You will see the document root defined as /var/www/html
change it to point to the folder of your liking e.g
/var/www/your-app
then save using ctrl + o
and run service apache2 restart
to reload your server then go to your browser and navigate to localhost.
The method above is ideal for localhost because we don't have domains.
in a server setup you would probably need to uncomment the ServerName directive and add your domain name next to itfor example.
ServerName mydomain.com
NB You can create as many sites as you want and enabling them with sudo a2esite site-name.conf
and the restart the server
Upvotes: 1