jeudi 28 janvier 2016

Installation d'Apache 2 sur Ubuntu


Avant toute installation, mettre à jour le "apt-get repository" :

sudo apt-get update


Installation du paquet "Apache 2"

$ sudo apt-get install apache2 


Le service apache est démarré immédiatement après l'installation et écoute sur le port 80.

Liste des processus 

$ ps -edf | grep apache
 root      4927     1  0 17:04 ?        00:00:00 /usr/sbin/apache2 -k start
 www-data  4930  4927  0 17:04 ?        00:00:00 /usr/sbin/apache2 -k start
 www-data  4931  4927  0 17:04 ?        00:00:00 /usr/sbin/apache2 -k start


Test avec un navigateur :  

http://adresse-ip-du-host/

Affiche "Apache2 Ubuntu Default Page"
avec les principales informations sur les fichiers de configuration :

The configuration layout for an Apache2 web server installation on Ubuntu systems is as follows:
/etc/apache2/
|-- apache2.conf
|       `--  ports.conf
|-- mods-enabled
|       |-- *.load
|       `-- *.conf
|-- conf-enabled
|       `-- *.conf
|-- sites-enabled
|       `-- *.conf

The default Ubuntu document root is /var/www/html.


Installation du mod "PHP"

$ sudo apt-get install php5 libapache2-mod-php5


Tester avec un primier fichier ".php" dans "/var/www/html" :

$ cd /var/www
$ chmod 777 html
$ cd html
$ vi phpinfo.php
<?php
  phpinfo();
?>

Test avec un navigateur :  
http://adresse-ip-du-host/phpinfo.php

Affiche la page standard d'information sur la version de PHP utilisée
"PHP Version 5.6.4-4ubuntu6.4"
etc...

Pour utiliser MySQL avec PHP  :  

sudo apt-get install php5-mysql 

Pour utiliser PostgreSQL avec PHP  :  

sudo apt-get install php5-pgsql 

Redémarrer Apache 2 (après installation des paquets complémentaires de PHP5 )  :  
sudo service apache2 restart

Nouveau test avec le navigateur :
http://adresse-ip-du-host/phpinfo.php

La page doit contenir les infos relatives aux paquets complémentaires,
par exemple pour "PostgreSQL" :
    "pdo_pgsql"
    "pgsql"


Aucun commentaire:

Enregistrer un commentaire