Virtual domains


Published on

Published in: Internet, Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Virtual domains

  1. 1. >_ Things Lab Virtual domains ...the standard installation for Things Lab meetings
  2. 2. Check an installed package ● Should be checked if all the packages are installed correctly, if not install the package. As example for unzip: (should be executed at command prompt/terminal) dpkg --get-selections | grep unzip sudo apt-get install unzip
  3. 3. Check and install all packages ● Should be installed all the following packages: php5, php-mysql, phpmyadmin, mysql-client, mysql- server and apache2 (check one by one or... directly install all if not yet installed...) sudo apt-get install php5 php5-mysql apache2 phpmyadmin mysql-client mysql-server
  4. 4. Play with vi, the easy way ● What is it vi? Google it or RTFM (at command prompt, man vi). ● Open the terminal and go in your home folder cd (enter) ● Open a new file (or existing if was already present, to open as root use sudo before the vi command) and try to use some basic commands of vi ● vi aaa.txt (enter) (esc) allows to enter in the command mode
  5. 5. Play with vi, part 1 (in command mode) i allows to enter in the insert mode (in command mode) x allows to delete a character (in command mode) dd (double d) allows to delete a line (in insert mode, means you are editing) press esc to enter in command mode
  6. 6. Play with vi, part 2 (in command mode) :q exit from the editing of the file, do not save changes (in command mode) :wq exit from the editing of the file, save all changes any other command? RTFM :-) If you have any problem, go in command mode and quit without saving the changes
  7. 7. Setup a local domain ● At the command prompt go in /etc/ folder cd /etc/ ● Edit the file hosts with root permissions using vi sudo vi hosts ● In vi move using the arrows and add a new line, the line should be as the following (instead test use your name): test ● Save and quit with the command :wq
  8. 8. Check the local domain ● At the command prompt check if the domain is responding to pings (what is it ping? RTFM!): ping test (in your case, your name) (enter) ● Create the folder where you will have your virtual domain: sudo mkdir /var/www/test/ (enter)
  9. 9. Setup a virtual host in apache ● At the command prompt go in /etc/apache2/sites- enabled folder cd /etc/apache2/sites-enabled/ ● Add a new file root permissions using vi sudo vi test (use your name instead) ● Start the insert mode and paste the text of the next page, change from test to your name!
  10. 10. Virtualhost configuration <VirtualHost *:80> ServerAdmin webmaster@localhost ServerName test DocumentRoot /var/www/test <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/test/> Options Indexes FollowSymLinks MultiViews AllowOverride None Order allow,deny allow from all </Directory> ErrorLog /var/log/apache2/test-error.log </VirtualHost>
  11. 11. Add files to the virtual domain ● In /var/www/test/ create a simple html file and insert some text: sudo vi /var/www/test/index.html (enter) (now you know how to do it! :-) ) ● In /var/www/test/ create a simple php (test.php) file and the following insert text (is ok in one line!): <?php print phpinfo(); ?>
  12. 12. Test the from the browser