How To Setup Virtual Spider Web Hosting Together With Host Multiple Sites On I Server ? [ Inwards 2 Infinitesimal ]
Learn how to setup virtual spider web hosting for multiple domains to live on server from i unmarried server.
Hey guys, welcome dorsum to Intelligent computing, previously i posted HOW TO SETUP YOUR AWS AND LAMP TO RUN YOUR FIRST PHP APP? Followed yesteryear HOW TO SETUP AND CONFIGURE LAMP ON UBUNTU SERVER? And its slap-up slice of article to setup aws in addition to deploy php spider web app/site on root of apache.
But if yous are having a pretty robust server and/or yous planning to deploy multiple websites on unmarried server nether multiple domains, yous need to measuring ahead in addition to practise virtual hosts inwards apache2 settings, which i’ll explicate how yous tin sack popular off along in addition to larn your novel site upward in addition to running on same server inwards few minutes.
If yous are running all application inwards codeigniter, yous tin sack setup all application inwards unmarried codeigniter installation[ Read How i purpose Codeigniter to Manage Multiple Versions of app in addition to switch inwards seconds?]
This physical care for i am explaining is for ubuntu alongside apache2 in addition to then everything going to live on accordingly.
Web Root : /var/www/html/
Apache2 : /etc/apache2/
Site configurations : /etc/apache2/sites-available/
Setting upward sites inwards directory
First of all yous need to brand certain your website/web app resides somewhere inwards spider web root directory, suppose you’ve directory called sites
/var/www/html/sites/ |
And yous get got 2 sites inwards it alongside folder site1.com in addition to site2.com
/var/www/html/sites/site1.com/ /var/www/html/sites/site2.com/ |
Pointing your domain to server
You tin sack only seat IP address of server inwards your DNS setting which volition get-go pointing your domain to server where yous are virtually to host your websites/web app.
It mightiness accept thirty infinitesimal to 1 hr to consummate this process, yous tin sack cheque this every bit follow
This volition present your server’s IP address i time it’s updated.
Now let’s popular off along to virtual host creation.
Create virtual host configuration
- Copy /etc/apache2/sites-available/000-default.conf to /etc/apache2/sites-available/site1.com.conf
sudo cp /etc/apache2/sites-available/000-default.conf /etc/apache2/sites-available/site1.com.conf |
- Open /etc/apache2/sites-available/site1.com.conf with your favourite editor inwards total admin/sudo fashion in addition to edit.
sudo vi /etc/apache2/sites-available/site1.com.conf |
- Edit file in addition to modify next lines in addition to supplant alongside yours configuration
ServerAdmin youremail@hostname.com DocumentRoot /var/www/html/sites/site1.com/ ErrorLog ${APACHE_LOG_DIR}/site1_error.log CustomLog ${APACHE_LOG_DIR}/site1_access.log combined |
These iv lines are clear
● Your electronic mail address for webmaster
● Document root for your website folder
● Error log cite to position fault of your site
● Access log file cite to position log for your site
You are almost done.
Enable site configuration
Now yous need to enable this configuration to enable site on your machine.
For this yous need to execute unproblematic a2ensite command for your newly configured site.
sudo a2ensite site1.com.conf |
And yeah yous get got enabled this site inwards your configuration, yous are i ascendence away to brand your site1.com live, precisely restart your apache in addition to done.
sudo service apache2 restart |
Once the ascendence is executed successfully, your site site1.com tin sack live on accessed from spider web conduct in addition to yous tin sack run into spider web pages/apps stores inwards /var/www/html/sites/site1.com/ directory
What’s next?
If yous human face upward whatever work inwards saving or execution of apache, cheque everything i time again, for whatever typo or like stuff.
Also practise non forget to cheque apache fault log if any, in addition to if yous are non able to restart apache.
You mightiness wants to know how Expert secure themselves inwards an amazing infographic post followed yesteryear sharing your website/web application from your localhost to anywhere on network to present individual your travel without deploying it on server.
If yous detect it useful, delight portion it to your peers on social media in addition to follow @inteligentcomp on twitter/facebook for to a greater extent than updates.