Installeren van Apache op mijn virtuele Ubuntu omgeving


Apache installeren

Lees hier meer daarover, of volg dit stappenplan:

  • Update het systeem:
sudo apt-get update
sudo apt-get upgrade

Installeer Apache:

sudo apt-get install apache2
 * Starting web server apache2                                                  AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using Set the 'ServerName' directive globally to suppress this message *
  • Open een webbrowser, en open:
  • if you read “It works!” which is the content of the file /var/www/index.html, this proves Apache works;
  • You can also use ifconfig (Ubuntu’s alternative for Windows ipconfig) to get your computers ip address and use this to test your webserver;
  • Webserver commando’s:
sudo /etc/init.d/apache2 stop / restart / start

Webpagina aanpassen:

sudo gedit /var/www/html/index.html


PHP 5 installeren

  • Open Terminal, enter:
sudo /etc/init.d/apache2 restart
  • Klik Install;
  • Start de module met dit commando:
sudo a2enmod php5

PHP 5 installatie controleren

  • Add an existing user to the www-data group:
sudo usermod -a -G www-data username
id username
groups username


  • In /var/www , create a text file called “test.php”;
  • Grant the world (or, at least, Ubuntu user “apache”) permission to read it;
  • Write in it the only line: “<?php phpinfo(); ?>” (without the quotation marks) then;
  • With your web browser, go to the URI “http://localhost/test.php“;
  • If you can see a description of PHP5 configuration, it proves PHP 5 works with Apache.