Install Apache

To install Apache open the terminal and type these commands:
sudo apt-get update

sudo apt-get install apache2

Make sure that your firewall allows HTTP and HTTPS traffic:
sudo ufw allow in "Apache Full"

Type your pubblic IP or localhost in your browser:



Your web server is now ready! with default configuration.

To restart Apache:
sudo service apache2 restart

To stop Apache:
sudo service apache2 stop

To start Apache:
sudo service apache2 start

Install MySQL

To install MySQL open the terminal and type this command:
sudo apt-get install mysql-server

During the installation, your server will ask you to select and confirm a password for the MySQL "root" user. This is an administrative account in MySQL.

Mettere in sicurezza MySQL (Facoltativo)

sudo mysql_secure_installation

Inserire "y" per "si" oppure qualsiasi altra lettera per "no".

Nel primo passaggio inserire la password dell'utente root, in seguito vi verrà chiesto se si vuole testare la sicurezza della password e se la si vuole cambiare.

Per i successivi passaggi è consigliato premere "y" quindi "si".

  • Rimuovere gli utenti anonimi
  • Disabilitare il login root da remoto
  • Rimuovere il database test
  • Aggiornare le nuove regole

Install PHP

To install PHP open the terminal and type this command:
sudo apt-get install php libapache2-mod-php php-mcrypt php-mysql

Restart Apache:
sudo service apache2 restart

Test PHP processing on your web server, create a PHP file at root location by typing:
sudo nano /var/www/html/info.php

Put the following text, inside the file:

<?php phpinfo(); ?>

Close and save.

Now we can test our web server. We just have to visit this page in our web browser.



If this was successful, then your PHP is working as expected.
The installation is now complete with basic configurations.