File tree 4 files changed +51
-0
lines changed
4 files changed +51
-0
lines changed Original file line number Diff line number Diff line change
1
+ FROM php:8.1-apache
2
+ COPY index.php /var/www/html/
3
+ EXPOSE 80
Original file line number Diff line number Diff line change
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 :
Original file line number Diff line number Diff line change
1
+ <?php
2
+
3
+ echo "Hello from " . gethostname ();
Original file line number Diff line number Diff line change
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
+ }
You can’t perform that action at this time.
0 commit comments