Skip to content

Commit ef3b4cf

Browse files
committed
init
1 parent 4283094 commit ef3b4cf

File tree

4 files changed

+51
-0
lines changed

4 files changed

+51
-0
lines changed

Dockerfile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM php:8.1-apache
2+
COPY index.php /var/www/html/
3+
EXPOSE 80

docker-compose.yml

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
version: '3'
2+
services:
3+
web:
4+
build: .
5+
networks:
6+
- webnet
7+
deploy:
8+
replicas: 3 # Uruchom 3 instancje
9+
restart: always
10+
11+
nginx:
12+
image: nginx
13+
ports:
14+
- "8080:80"
15+
volumes:
16+
- ./nginx.conf:/etc/nginx/nginx.conf
17+
networks:
18+
- webnet
19+
depends_on:
20+
- web
21+
22+
networks:
23+
webnet:

index.php

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
<?php
2+
3+
echo "Hello from " . gethostname();

nginx.conf

+22
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
worker_processes 3;
2+
events {
3+
worker_connections 1024;
4+
}
5+
6+
http {
7+
upstream php-app {
8+
server web:80; # Nazwa usługi aplikacji PHP w docker-compose.yml
9+
}
10+
11+
server {
12+
listen 80; # Nginx nasłuchuje na porcie 80
13+
14+
location / {
15+
proxy_pass http://php-app; # Przekazywanie ruchu do grupy serwerów
16+
proxy_set_header Host $host; # Ustawienie nagłówków
17+
proxy_set_header X-Real-IP $remote_addr;
18+
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
19+
proxy_set_header X-Forwarded-Proto $scheme;
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)