Skip to content

Commit

Permalink
first homework release
Browse files Browse the repository at this point in the history
  • Loading branch information
pvSource committed Sep 18, 2023
1 parent 75599f1 commit e122aa4
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 0 deletions.
7 changes: 7 additions & 0 deletions code/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

echo "Привет, Otus!<br>".date("Y-m-d H:i:s") ."<br><br>";

Check failure on line 3 in code/index.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected at least 1 space before &quot;.&quot;; 0 found

Check failure on line 3 in code/index.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected at least 1 space after &quot;.&quot;; 0 found

Check failure on line 3 in code/index.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected at least 1 space after &quot;.&quot;; 0 found

echo "Что-то еще 22";

phpinfo();

Check failure on line 7 in code/index.php

View workflow job for this annotation

GitHub Actions / phpcs

Expected 1 newline at end of file; 0 found
1 change: 1 addition & 0 deletions code/test/index.php
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
<?php
Empty file added docker-compose.yaml
Empty file.
12 changes: 12 additions & 0 deletions nginx/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
FROM nginx:latest

COPY ./hosts/mysite.local.conf /etc/nginx/conf.d/mysite.local.conf

WORKDIR /data

#Примонтированые данные из хостовой ОС - двунаправленная директория
VOLUME /data

EXPOSE 80

CMD ["nginx", "-g", "daemon off;"]
36 changes: 36 additions & 0 deletions nginx/hosts/mysite.local.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
server {
# указываем 80 порт для соединения
listen 80;
# нужно указать, какому доменному имени принадлежит наш конфиг
server_name mysite.local;

# задаём корневую директорию
root /data/mysite.local;

# стартовый файл
index index.php index.html;

# при обращении к статическим файлам логи не нужны, равно как и обращение к fpm
# http://mysite.local/static/some.png
location ~* .(jpg|jpeg|gif|css|png|js|ico|html)$ {
access_log off;
expires max;
}

# помним про единую точку доступа
# все запросы заворачиваются в корневую директорию root на index.php
location / {
try_files $uri $uri/ /index.php?$query_string;
}

# и наконец правило обращения к php-fpm
location ~* .php$ {
try_files $uri = 404;
fastcgi_split_path_info ^(.+.php)(/.+)$;
fastcgi_pass app:9000;
#fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}

0 comments on commit e122aa4

Please sign in to comment.