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
it's really cool blog. Linking is very useful thing.you have really helped
ReplyDeletedata science course in delhi
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.
ReplyDeletetraining provider in malaysia
ReplyDeleteIncredibly 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
I recently found many useful information in your website especially this blog page. Among the lots of comments on your articles. Thanks for sharing.
ReplyDeleteDigital Marketing Training Institutes in Hyderabad
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.
ReplyDeletedata science course in aurangabad
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
ReplyDeleteGood information you shared. keep posting.
ReplyDeletedata scientist Certification Course