Build Website in Ubuntu

This article will tell you how to build a website in ubuntu system. First you should install apache and php. These two tools can help you to build a small website, like “hello world” websit:D

// run the following commands
sudo apt-get install apache2 php5 libapache2-mod-php5
/etc/init.d/apache2 restart

important path

Then you should remember the following paths:

  • /etc/init.d/apache2
  • /var/www
  • /etc/apache2/apache2.conf
  • /etc/apache2/conf.d
  • /etc/apache2/sites-enabled

Apache’s default document root is /var/www on Ubuntu, and the configuration file is /etc/apache2/apache2.conf. Additional configurations are stored in subdirectories of the /etc/apache2 directory such as /etc/apache2/mods-enabled (for Apache modules), /etc/apache2/sites-enabled (for virtual hosts), and /etc/apache2/conf.d

Test your php

1
vi /var/www/hello.php
1
2
3
<?php
phpinfo();
?>

Then call this file in browser (http://localhost/hello.php)
DONE:D