You are on page 1of 2

Avant toute chose il faut que DNS soit operationnel

Étape 1 - Installation d'Apache


---------
#apt install apache2

Étape 2 - Installation de MariaDB


-------
#apt install mariadb-server
#activer: systemctl restart mariadb
#redemarrer: systemctl restart mariadb
#configurer la securite: mysql_secure_installation
#creer la base: CREATE DATABASE example_database;
#autoriser les privileges: GRANT ALL ON example_database.* TO
'example_user'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;

Étape 3 - Installation de PHP


-------
#apt install php libapache2-mod-php php-mysql
#prefernece des fichier php: vim /etc/apache2/mods-enabled/dir.conf

<IfModule mod_dir.c>
DirectoryIndex index.html index.cgi index.pl index.php index.xhtml index.htm
</IfModule>

||

<IfModule mod_dir.c>
DirectoryIndex index.php index.html index.cgi index.pl index.xhtml index.htm
</IfModule>

#redamrrer: systemctl reload apache2


#activer: systemctl enable apache2
#status: systemctl status apache2

Étape 4 - Création de votre site Web et test du traitement php


-------
#vim /var/www/html/info.php
#tester votre page ifo.php: http://your_domain/info.php

<?php
phpinfo();
?>

Etape 5: test de la connexion a la base


-------
<?php
$user = "example_user";
$password = "password";
$database = "example_database";
$table = "todo_list";

try {
$db = new PDO("mysql:host=localhost;dbname=$database", $user, $password);

} catch (PDOException $e) {


echo "Error!: " . $e->getMessage() . "<br/>";

}
Etape 6: Configuration https
-------
#redemarrer appache2: systectl restart appache2
#activer le module ssl: a2enmod ssl
#redemarrer appache2: systectl restart appache2
#activer le site wb par defaut: a2ensite default-ssl
#redemarrer appache2: systectl restart appache2
#Créez un certificat SSL auto-signé: mkdir /etc/apache2/ssl
#openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout
/etc/apache2/ssl/apache.key -out /etc/apache2/ssl/apache.crt

You are about to be asked to enter information that will be incorporated


into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
——-
Country Name (2 letter code) [AU]:US
Locality Name (eg, city) []:NYC
Organization Name (eg, company) [Internet Widgits Pty Ltd]:DigitalOcean
Organizational Unit Name (eg, section) []:SSL Certificate Test
Common Name (e.g. server FQDN or YOUR name) []:example.com
Email Address []:test@example.com

#definir les autorisations pour proteger votre cle: chmod 600 /etc/apache2/ssl/*
#configurer Appache pour utilise SSL: vim /etc/apache2/sites-enabled/default-
ssl.conf

ServerAdmin webmaster@localhost
ServerName example.com:443(nom de votre domaine)

SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

#verifier votre fichier s'il ressemble default-ssl.conf

<IfModule mod_ssl.c>
<VirtualHost _default_:443>
ServerAdmin webmaster@localhost
ServerName example.com:443
DocumentRoot /var/www/html

. . .
SSLEngine on

. . .

SSLCertificateFile /etc/apache2/ssl/apache.crt
SSLCertificateKeyFile /etc/apache2/ssl/apache.key

#redemarrer appache2: systectl restart appache2


#tester votre page: https://votre domaine

You might also like