How To Setup Virtual Web Server At Localhost On Apache Web

Hello there This article deals about how to setup virtual Web server at Localhost on Apache Web server.

What are Virtual Web Servers?

A virtual Web server is a server that shares hardware and software resources with other web servers like apache server versus dedicated servers. Because they are cost-effective and provide faster resource control, virtual Web servers are popular in Web hosting environments.

we will create a Virtual server at localhost to run our websites suppurate and to get customization. this is good for if you are developing RESTful or MVC frameworks.

Go to location /etc/apache2/sites_available
there is a default file don’t edit that create new file with the extension .conf

The name which you want to give to your server the same should be the conf file and paste the following.

ServerName myserver
ServerAdmin admin@myserver
DocumentRoot /var/www/html/

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Include conf-available/serve-cgi-bin.conf
vim: syntax=apache ts=4 sw=4 sts=4 sr noet

write your desired name in ServerName replace the myserver and also change the Server location where you have stored your project files. also change username. save if as yourservername.conf  Open the Default.conf file find in the same directory edit that paste the following codes after

</virtualhost>

XML tag

Options Indexes FollowSymLinks MultiViews Allow Override All Order allow,deny allow from all then to access your hostname as website name in browser go to /etc/hosts file and edit it

127.0.0.1                   yourhostname

That’s it you’ve done. save all and go to browser type your hostname on URL bar thats it you’ll get location which you’ve specified in .conf file.

I hope this article was helpful in understanding and creating Virtual Web server. if you got any problems please comment .

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

Your email address will not be published. Required fields are marked *