Ajout d'une partie du TP4
This commit is contained in:
54
TP4/docker-compose.yml
Normal file
54
TP4/docker-compose.yml
Normal file
@@ -0,0 +1,54 @@
|
||||
services:
|
||||
redis:
|
||||
image: redis/redis-stack
|
||||
ports:
|
||||
- "6379:6379"
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
restart: always
|
||||
networks:
|
||||
- back
|
||||
|
||||
redisinsight:
|
||||
image: redis/redisinsight
|
||||
ports:
|
||||
- "5540:5540"
|
||||
restart: always
|
||||
volumes:
|
||||
- redisinsight_data:/db
|
||||
networks:
|
||||
- back
|
||||
|
||||
php:
|
||||
image: windok/php-redis
|
||||
restart: always
|
||||
volumes:
|
||||
- ./web:/usr/share/nginx/html
|
||||
environment:
|
||||
NOM : "moguljak"
|
||||
PRENOM : "tom"
|
||||
deploy:
|
||||
replicas: 2
|
||||
networks:
|
||||
- front
|
||||
- back
|
||||
|
||||
nginx :
|
||||
image: nginx
|
||||
restart: always
|
||||
ports:
|
||||
- "80:80"
|
||||
- "443:443"
|
||||
volumes:
|
||||
- ./web:/usr/share/nginx/html
|
||||
- ./nginx:/etc/nginx/conf.d
|
||||
networks:
|
||||
- front
|
||||
|
||||
networks:
|
||||
front:
|
||||
back:
|
||||
|
||||
volumes:
|
||||
redis_data:
|
||||
redisinsight_data:
|
14
TP4/nginx/default.conf
Normal file
14
TP4/nginx/default.conf
Normal file
@@ -0,0 +1,14 @@
|
||||
server {
|
||||
|
||||
server_name tp4.iut.fr;
|
||||
listen 80;
|
||||
root /usr/share/nginx/html;
|
||||
index index.php index.html;
|
||||
|
||||
location ~ \.php$ {
|
||||
fastcgi_pass php:9000;
|
||||
fastcgi_index index.php;
|
||||
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
|
||||
include fastcgi_params;
|
||||
}
|
||||
}
|
27
TP4/web/index.php
Normal file
27
TP4/web/index.php
Normal file
@@ -0,0 +1,27 @@
|
||||
<?php
|
||||
|
||||
$redis = new Redis();
|
||||
$redis->connect('tp4-redis-1', 6379);
|
||||
$code = $redis->get('code');
|
||||
|
||||
echo "
|
||||
<table>
|
||||
<tr>
|
||||
<td>SERVERNAME</td>
|
||||
<td><b>".$_SERVER['SERVER_NAME']."</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>HOSTNAME</td>
|
||||
<td><b>".gethostname()."</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>ETUDIANT</td>
|
||||
<td><b>".$_ENV['NOM']." / ".$_ENV['PRENOM']."</b></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>CODE</td>
|
||||
<td><b>$code</b></td>
|
||||
</tr>
|
||||
|
||||
|
||||
</table>";
|
Reference in New Issue
Block a user