Skip to content

Commit

Permalink
"start" and "server-configuration" pages added
Browse files Browse the repository at this point in the history
  • Loading branch information
igordata committed Jul 7, 2016
1 parent 6beecc5 commit 5d607de
Show file tree
Hide file tree
Showing 6 changed files with 136 additions and 66 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
.idea
.svn/
9 changes: 9 additions & 0 deletions app/backend/chunks/ru/manual/sidemenu.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
<li>
<a href="/ru/manual">Доки</a>
<ul>
<li>
<a href="/ru/manual/start">С чего начать?</a>
[[*menu start]]
</li>
<li>
<a href="/ru/manual/server-configuration">Настройка сервера</a>
[[*menu server configuration]]
</li>
<li>
<a href="/ru/manual/routing">Роутинг</a>
</li>
Expand Down
55 changes: 5 additions & 50 deletions app/backend/pages/ru/examples/important.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
То есть, каждый пример требует установки движка PinPIE в папку примера (или наоборот).
Я не включаю движок в примеры, так как они не привязаны к конкретной версии.
</p>
<p>
Минимальные требования для запуска примеров описаны в доке по
<a href="/ru/manual/start">началу работы с движком PinPIE</a>.
</p>
</section>
<section>
<header>
Expand All @@ -27,54 +32,4 @@
</p>
</section>
<section>
<header>
<h1>Конфиги вебсерверов</h1>
</header>
<h2>Nginx</h2>
<h3>Простой</h3>
<code class="nginx">
<pre>server {
server_name site.com;
root /var/www/site.com/;
access_log /var/log/nginx/site.com.access.log main;

location / {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_read_timeout 30s;
include /etc/nginx/fastcgi_params;
}

location ~* ^.+\.(jpg|jpeg|gif|ico|txt|png)$ {
access_log off;
}
}</pre>
</code>
<h3>С шардингом статик серверов</h3>
<code>
<pre>server {
server_name site.com;
root /var/www/site.com/;
access_log /var/log/nginx/site.com.access.log main;

location / {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_read_timeout 30s;
include /etc/nginx/fastcgi_params;
}

location ~* ^.+\.(jpg|jpeg|gif|ico|txt|png)$ {
access_log off;
}
}

server {
server_name s1.site.com s2.site.com s3.site.com;
root /var/www/site.com/;
}</pre>
</code>
<h3></h3>
</section>
</article>
5 changes: 1 addition & 4 deletions app/backend/pages/ru/manual/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -252,10 +252,7 @@
Pages folder
</h1>
</header>
<p>
Место хранения страниц. Дефолтное значение <?= scx('ROOT . "/pages"', 'php') ?>.
Можно поменять на лету в "preinclude.php" или раньше.
</p>
<p>Место хранения страниц. Дефолтное значение <?= scx('ROOT . "/pages"', 'php') ?>.</p>
</section>

<section>
Expand Down
65 changes: 65 additions & 0 deletions app/backend/pages/ru/manual/server-configuration.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[title[=Настройка сервера]]
[sidemenu[ru/manual/sidemenu]]
[menu server configuration[=
<ul>
<li><a href="#nginx">Nginx</a></li>
</ul>
]]
<article>
<header>
<h1>Настройка веб-сервера для работы PinPIE</h1>
</header>

<section>
<header>
<h1>
<a name="nginx" href="#nginx">#</a>
Nginx
</h1>
</header>
<h2>Простой</h2>
<code class="nginx">
<pre>server {
server_name site.com;
root /var/www/site.com/;
access_log /var/log/nginx/site.com.access.log main;

location / {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_read_timeout 30s;
include /etc/nginx/fastcgi_params;
}

location ~* ^.+\.(jpg|jpeg|gif|ico|txt|png)$ {
access_log off;
}
}</pre>
</code>
<h2>С шардингом статик серверов</h2>
<code>
<pre>server {
server_name site.com;
root /var/www/site.com/;
access_log /var/log/nginx/site.com.access.log main;

location / {
fastcgi_pass unix:/var/run/php-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root/index.php;
fastcgi_read_timeout 30s;
include /etc/nginx/fastcgi_params;
}

location ~* ^.+\.(jpg|jpeg|gif|ico|txt|png)$ {
access_log off;
}
}

server {
server_name s1.site.com s2.site.com s3.site.com;
root /var/www/site.com/;
}</pre>
</code>
<h3></h3>
</section>
</article>
67 changes: 55 additions & 12 deletions app/backend/pages/ru/manual/start.php
Original file line number Diff line number Diff line change
@@ -1,25 +1,68 @@
[title[=Начало работы с PinPIE]]
[sidemenu[ru/manual/sidemenu]]
[menu start[=
<ul>
<li><a href="#entry-point">Точка входа</a></li>
<li><a href="#preinclude">preinclude.php</a></li>
</ul>
]]
<article>
<header>
<h1>Начни использовать PinPIE</h1>
</header>
<section>
<header>
<a name="dfdf">#</a>
<h1></h1>
<h1>
<a name="entry-point" href="#entry-point">#</a>
Точка входа
</h1>
</header>
<p>
Для запуска PinPIE необходимо инклудить его в главной точке входа вашего проекта,
а все запросы направить на этот файл.
Обычно, главная точка входа в код сайта это "/index.php".
Чтобы PinPIE начал работать, внутри этого файла должна быть такая строчка:
</p>
<?= pcx('include "pinpie/pinpie.php";') ?>
<p>В принципе, это всё, что требуется для того, чтобы начать использовать PinPIE.</p>
<p>
Обеспечить направление всех запросов на "/index.php" или другой файл можно в конфиге веб-сервера.
Примеры конфигов можно найти в разделе документации по
<a href="/ru/manual/server-configuration">конфигурации сервера</a>.
</p>
</section>
<section>

<section>
<header>
<h1>Точка входа</h1>
<h1>
<a name="preinclude" href="#preinclude">#</a>
Файлы preinclude.php и postinclude.php
</h1>
</header>
<p>PinPIE require to be included in main entry point of your project, and all requests have to be rerouted to that file. Generally, the main entry point for site code is `ROOT/index.php`. This file require to have `include 'pinpie/pinpie.php';` line to start PinPIE working.</p>
<p>This, in fact, are the only things you have to do to start using PinPIE.</p>
<h2>About preinclude.php and postinclude.php</h2>
<p>
For every request there are to files, that will be included if they exist. Before processing a page file `ROOT/preinclude.php` will be included. And `ROOT/postinclude.php` will be included after page is processed and assembled. If you will upgrade PinPIE with new version, this files will not be overwritten, because this
files doesn't exist in PinPIE project. So feel free to modify them corresponding your needs.</p>
При каждом запросе PinPIE попытается подключить два файла, если они существуют:
<?= scx("ROOT/preinclude.php") ?> и <?= scx("ROOT/preinclude.php") ?>,
где <?= scx("ROOT") ?> это <a href="/ru/manual/constants#root">константа корневого пути</a>.
Пути к этим файлам можно изменить в <a href="http://pinpie.ru/ru/manual/config">конфиге</a>.
</p>
<p>
Сначала проверяется существование файла <?= scx("ROOT/preinclude.php") ?>.
Если он есть &mdash; он инклудится. Его отличие от <?= scx("ROOT/index.php") ?> в том,
что в момент его инклуда уже заданы основные параметры PinPIE: прочитан конфиг,
определён файл-обработчик запроса <?=scx('PinPIE::$document', 'php')?>, который можно изменить
по своему усмотрению.
</p>
<p>Данный файл подходит для размещения кода автозагрузчика классов.
Впрочем, для этой задачи подходит и <?= scx("ROOT/index.php") ?>.</p>
<p>
Потом, когда закончена обработка запроса, PinPIE пытается включить файл <?= scx("ROOT/preinclude.php") ?>.
Этот файл подходит для вывода дебаг информации и отложенных действий,
например с помощью <a href="http://php.net/manual/en/function.fastcgi-finish-request.php">fastcgi_finish_request()</a>.
</p>
<p>
При обновлении файлов PinPIE на новую версию, эти файлы не пропадут и не будут перезаписаны,
т.к. они отсутствуют в самом PinPIE. Так что можете уверенно использовать эти файлы
для своих нужд.
</p>
</section>
</article>

0 comments on commit 5d607de

Please sign in to comment.