Initial commit.

This commit is contained in:
Florian THIERRY
2022-05-22 12:51:19 +02:00
commit 56916a7970
6 changed files with 112 additions and 0 deletions

23
docker-compose.yml Normal file
View File

@@ -0,0 +1,23 @@
version: '3.6'
services:
nginx:
image: nginx:1.21.6
container_name: nginx
ports:
- '12345:80'
networks:
- my_app
volumes:
- './www:/usr/share/nginx/html:ro'
- './nginx.conf:/etc/nginx/nginx.conf:ro'
php:
image: php:8.1-fpm-alpine
container_name: php
networks:
- my_app
volumes:
- './www:/app:ro'
networks:
my_app:

18
fastcgi.conf Normal file
View File

@@ -0,0 +1,18 @@
#fastcgi.conf
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;

41
nginx.conf Normal file
View File

@@ -0,0 +1,41 @@
user nginx;
worker_processes 1;
error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main '$remote_addr - $remote_user [$time_local] "$request" $status $body_bytes_sent "$http_referer" "$http_user_agent" "$http_x_forwarded_for"';
access_log /var/log/nginx/access.log main;
sendfile on;
keepalive_timeout 65;
server_tokens off;
server {
listen 80;
server_name my.app;
root /app;
location / {
root /usr/share/nginx/html;
try_files $uri $uri/ =404;
}
location ~ \.php$ {
root /usr/share/nginx/html;
include fastcgi_params;
fastcgi_pass php:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /app/$fastcgi_script_name;
}
}
}

9
www/app.html Normal file
View File

@@ -0,0 +1,9 @@
<!DOCTYPE>
<html>
<head>
<title>App html</title>
</head>
<body>
<h1>Application HTML</h1>
</body>
</html>

12
www/app.php Normal file
View File

@@ -0,0 +1,12 @@
<?php
$message = "Application PHP";
?>
<!DOCTYPE>
<html>
<head>
<title>App php</title>
</head>
<body>
<h1><?php echo $message; ?></h1>
</body>
</html>

9
www/test.html Normal file
View File

@@ -0,0 +1,9 @@
<!DOCTYPE>
<html>
<head>
<title>Test html</title>
</head>
<body>
<h1>Test HTML</h1>
</body>
</html>