Skip to main content

How To Set Up Apache Virtual Hosts on Ubuntu

How to setup Virtual Host in Ubuntu 16 / Ubuntu 18 on localhost / local machine

To run the website with host on localhost(With LAMP) becomes important in many cases.
This blog post will demonstrate how to achieve this. Assuming you have LAMP already installed and reading the code from (/var/www/html)
Follow the simple steps below
  • Create the code base
To Create the code, simply create a directory named localweb inside /var/www/html.
  • Create a file index.php inside localweb directory
Content of index.php file
<?php 
echo "Local Website";
?>

Now our code base is set, so we need to configure apache
Go to apache directory
cd  /etc/apache2/sites-available/
Create one file named localweb.conf with content

<Directory /var/www/html/localweb/>
    AllowOverride All
</Directory>

<VirtualHost *:80>
    ServerAdmin admin@localweb.com
    ServerName localweb.com
    ServerAlias www.localweb.com
    DocumentRoot /var/www/html/localweb
    ErrorLog ${APACHE_LOG_DIR}/localweb.com-error.log
    CustomLog ${APACHE_LOG_DIR}/localweb.com-access.log combined
</VirtualHost>

Once this is done, we need to enable the site created and restart the apache
sudo a2ensite localweb.conf
sudo service apache2 restart

Lastly, go to /etc/hosts, add the line after localhost
127.0.0.1       localweb.com


You can find out Kubernetes blog here

Comments

  1. it's really cool blog. Linking is very useful thing.you have really helped
    data science course in delhi

    ReplyDelete
  2. Its most perceptibly horrendous piece was that the item just worked spasmodically and the data was not exact. You unmistakably canot confront anyone about what you have found if the information isn't right.
    training provider in malaysia

    ReplyDelete

  3. Incredibly conventional blog and articles. I am realy very happy to visit your blog. Directly I am found which I truly need. Thankful to you and keeping it together for your new post.
    hrdf claimable training

    ReplyDelete
  4. I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing.
    Digital Marketing Training Institutes in Hyderabad

    ReplyDelete
  5. I'm cheerful I found this blog! Every now and then, understudies need to psychologically the keys of beneficial artistic articles forming. Your information about this great post can turn into a reason for such individuals.
    data science course in aurangabad

    ReplyDelete
  6. Good. I am really impressed with your writing talents and also with the layout on your weblog. Appreciate, Is this a paid subject matter or did you customize it yourself? Either way keep up the nice quality writing, it is rare to peer a nice weblog like this one nowadays. Thank you, check also virtual edge and thank you email for attending event

    ReplyDelete

Post a Comment

Popular posts from this blog

Login with Google Account using PHP / Javascript using OAuth2.0

Login with Google Account using PHP with code This post have Complete Code for Login / Sign-in  with google Account  using PHP / Javascript with oAuth2.0 Basically today we have seen almost every website needs you to register yourself before you can post or take part in any discussions to the website. But it become a tedious task to register and login to many different sites. Solution is to provide the users the option to Login with existing Google / Facebook account as almost everyone have Facebook and Google account.. In this post, I am going to explain how to integrate the Google Login / Sign in  for your website. For this,  First you need to create your Client ID, Client Secret and your developer API key. For this go to https://developers.google.com/identity/sign-in/web/sign-in Click on the button Create Project. A new window will open up. Please select Create Project / or select already created Project. It will then ask for about type of Project. Please

JSON Introduction

Now a days, JSON has become a hot topic. Developers today are really getting interesting in JSON. So, in this post I am going to explain what is JSON. JSON : JavaScript Object Notation  is a technology / format to store the data in key - value pairs i.e. the large amount of data can be stored / transmit using a JSON. Like for example : For a php developer, it is common to create the AJAX backend page and to send the data back to main page. Previously it was kind of tedious as user needs to create an array and needs to handle everything by himself / herself. But with JSON, it becomes very easy. JUST CREATE A JSON OBJECT containing the data, pass it to main page and use it.. simple. and this is just a very basic example. JSON is widely used in all Documents-Oriented Databases (like MongoDB[http://learnandsharetoall.blogspot.in/2014/01/what-is-mongodb.html], Hadoop, NoSQL etc.). So JSON's application is very very much extended. Now to understand JSON, lets divide it in