+5 votes
199 views
How to configure a virtual Apache host on Debian

in Linux / Unix by (552k points)
recategorized by | 199 views

1 Answer

+3 votes
Best answer

Install apache
Create new Virtual host file
Enable new Virtual hosts files:
Restart Apache:
Configurar el archivo de hosts local

We continue to play with Debian on our test server, today we are presented with the need to configure a Virtual Host, so helped by a university guide I built a step by step to configure Apache virtual hosts in Debian.

Install apache

sudo apt-get update
sudo apt-get install apache2

Create new Virtual host file

Download our test virtual.conf file from here . Then we must copy the file  virtual.conf to the folder  /etc/apache2/sites-available/ for the new domain.

cp virtual.conf /etc/apache2/sites-available/

If required, we can change the name of the file. (For testing will use the name: virtual)

Then we must change the following fields  ServerName, ServerAdmin,DocumentRoot

Enable new Virtual hosts files:

a2ensite virtual.conf

Restart Apache:

service apache2 restart

Configurar el archivo de hosts local

Open the file hosts for it type nano /etc/hosts

Add the new IP of your server, at the bottom of the file as localhost.

There will be something like this:

127.0.0.1 localhost
127.0.0.10 wp
127.0.0.11 yii

# The following lines are desirable for IPv6 capable hosts
:: 1 localhost ip6-localhost ip6-loopback
ff02 :: 1 ip6-allnodes
ff02 :: 2 ip6-allrouters

With this, a Virtual Host in Debian would be well configured


by (3.5m points)
edited by

Related questions

+5 votes
1 answer
asked Jun 23, 2019 in Web Servers by backtothefuture (552k points) | 240 views
+3 votes
1 answer
+4 votes
1 answer
asked Nov 16, 2019 in Linux / Unix by backtothefuture (552k points) | 276 views
+3 votes
1 answer
asked Nov 4, 2019 in Linux / Unix by backtothefuture (552k points) | 263 views
+4 votes
1 answer
asked Oct 10, 2019 in Linux / Unix by backtothefuture (552k points) | 283 views
Sponsored articles cost $40 per post. You can contact us via Feedback

Most popular questions within the last 30 days

10,659 questions
10,791 answers
510 comments
3 users