1

I am working Linux Mint 17.3 and trying to create virtual hosts on Apache 2.4. I have followed the following procedure, but still can't browse the site:

  1. Create two new virtual hosts
    sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/site1.com.conf

  2. modify each host
    sudo vim /etc/apache2/sites-available/site1.com.conf
    ServerName site1.com
    ServerAlias www.site1.com
    ServerAdmin [email protected]
    DocumentRoot /var/www/site1.com/public_html
    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined

3.Enable the New Virtual Host Files
sudo a2ensite site1.com

// Disable original html host
sudo a2dissite 000-default.conf

sudo service apache2 reload

  1. Add host info
    sudo vim /etc/hosts
    127.0.0.1:88 site1.com
    127.0.0.1:89 site2.com

I have checked out everything online, that I could. Today is my second day. Thanks in advance for your help.

1 Answer 1

0

In your second step, you should declare that host as a VirtualHost in the conf file:

<VirtualHost *:80>
   ServerName site1.com 
   ServerAlias www.site1.com 
   ServerAdmin [email protected]
   DocumentRoot /var/www/site1.com/public_html
   ErrorLog ${APACHE_LOG_DIR}/error.log
   CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost>
Sign up to request clarification or add additional context in comments.

1 Comment

Yes I have done that already. I want to know did I follow the right path or am missing some step in between. Bye the way thanks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.