You are on page 1of 2

Avant toute chose il faut que DNS soit fonctionnel

Etape 1: installer epel-release et mod_ssl


-------
#yum install epel-release

Etape 2: installer mysql/mariadb


-------
#yum install mariadb mariadb-server
#activer: systemctl enable mariadb
#redamarrer: systemctl restart mariadb
#configurer la securite: mysql_secure_installation
#redamarrer: systemctl restart mariadb

Etape 3: Installer nginx


-------
#yum install nginx
#activer: systemctl enable nginx
#redamarrer: systemctl restart nginx

Etape 4: Insataller PHP et PHP-FPM


-------
#yum install php php-mysqlnd php-fpm
#activer: systemctl enable php-fpm
#redamarrer:systemctl restart php-fpm
configurer:
#vim /etc/php.ini
rechercher: cgi.fix_pathinfo=0

Etape 5: editer le fichier www.conf


-------
#vim /etc/php-fpm.d/www.conf
rechercher: user = nginx
rechercher: group = nginx
rechercher: listen = /var/run/php-fpm/php-fpm.sock;
rechercher: listen.owner = nginx
rechercher: listen.group = nginx
rechercher: listen.mode = 0660
#redemarrer: systemctl restart php-fpm

Etape 6: Configurer nginx pour le traitement des page


-------
#vim /etc/nginx/conf.d/default.conf

server {
listen 80;
server_name server_domain_or_IP;

root /usr/share/nginx/html;
index index.php index.html index.htm;

location / {
try_files $uri $uri/ =404;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;

location = /50x.html {
root /usr/share/nginx/html;
}

location ~ \.php$ {
try_files $uri =404;
fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

#redemarrer: systemctl restart nginx

Etape 7: Test du traitement php


-------
#vim /usr/share/nginx/html/info.php

<?php
phpinfo();
?>

Etape 8: securisation
-------
#mkdri /etc/httpd/ssl
#openssl req -x509 -nodes -days 365 -newkey rsa:2048 -keyout
/etc/httpd/ssl/apache.key -out /etc/httpd/ssl/apache.crt

You might also like