Outils pour utilisateurs

Outils du site


apache:installation_sous_ubuntu_19.10

Installation Apache+PHP sous Ubuntu 19.10

Machine de développement (pas un serveur)

Installation d'Apache

sudo apt update
sudo apt install apache2

Aller sur http://localhost/. La page Apache2 Ubuntu Default Page s'affiche.

Installation de PHP

sudo apt install php libapache2-mod-php php-mysql

Tester le fonctionnement de PHP :

php -v

Installation de Composer

Se référer à cette page.

Configuration du VirtualHost

Éditer la configuration du site par défaut :

sudo vim /etc/apache2/sites-available/000-default.conf

Y coller la configuration suivante :

<VirtualHost *:80>
        ServerName localhost
        ServerAdmin myself@mail.com
        DocumentRoot /home/marc/PrgWeb
 
        <Directory /home/marc/PrgWeb/>
                Options Indexes FollowSymLinks Multiviews
                AllowOverride all
                Require all denied
                Require all granted
                Allow from all
        </Directory>
</VirtualHost>

Ensuite relancer Apache :

sudo systemctl reload apache2

Écrire un fichier test.php :

test.php
<?php
phpinfo();

Ensuite tester que tout fonctionne bien en allant sur http://localhost/test.php

-= Fin =-

apache/installation_sous_ubuntu_19.10.txt · Dernière modification: 2022/02/06 07:34 (modification externe)