Skip to content

Commit 8c6610f

Browse files
committed
Merge branch '2.0' into 2.1
Conflicts: book/service_container.rst cookbook/map.rst.inc cookbook/routing/index.rst
2 parents b98619e + 4be8c5b commit 8c6610f

File tree

15 files changed

+410
-6
lines changed

15 files changed

+410
-6
lines changed

book/controller.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,14 @@ working with forms, for example::
332332
.. index::
333333
single: Controller; Base controller class
334334

335+
Creating Static Pages
336+
---------------------
337+
338+
You can create a static page without even creating a controller (only a route
339+
and template are needed).
340+
341+
Use it! See :doc:`/cookbook/templating/render_without_controller`.
342+
335343
The Base Controller Class
336344
-------------------------
337345

book/installation.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -294,8 +294,10 @@ Symfony2 should welcome and congratulate you for your hard work so far!
294294
this is not required for development it is recommended at the time your
295295
application goes into production as all system and configuration files
296296
become inaccessible to clients then. For information on configuring
297-
your specific web server document root, see the following
298-
documentation: `Apache`_ | `Nginx`_ .
297+
your specific web server document root, read
298+
:doc:`/cookbook/configuration/web_server_configuration`
299+
or consult the official documentation of your webserver:
300+
`Apache`_ | `Nginx`_ .
299301

300302
Beginning Development
301303
---------------------

book/page_creation.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -439,6 +439,8 @@ the same basic and recommended directory structure:
439439

440440
* ``web/``: This is the web root directory and contains any publicly accessible files;
441441

442+
.. _the-web-directory:
443+
442444
The Web Directory
443445
~~~~~~~~~~~~~~~~~
444446

book/routing.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,6 +763,7 @@ a slash. URLs matching this route might look like:
763763

764764
* ``/articles/en/2010/my-post``
765765
* ``/articles/fr/2010/my-post.rss``
766+
* ``/articles/en/2013/my-latest-post.html``
766767

767768
.. _book-routing-format-param:
768769

@@ -1046,7 +1047,7 @@ the command by running the following from the root of your project.
10461047
10471048
$ php app/console router:debug
10481049
1049-
The command will print a helpful list of *all* the configured routes in
1050+
This command will print a helpful list of *all* the configured routes in
10501051
your application:
10511052

10521053
.. code-block:: text

book/service_container.rst

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,23 @@ looks up the value of each parameter and uses it in the service definition.
244244
# This will be parsed as string "@securepass"
245245
mailer_password: "@@securepass"
246246
247+
.. note::
248+
249+
The percent sign inside a parameter or argument, as part of the string, must
250+
be escaped with another percent sign:
251+
252+
.. code-block:: xml
253+
254+
<argument type="string">http://symfony.com/?foo=%%s&bar=%%d</argument>
255+
256+
.. caution::
257+
258+
You may receive a
259+
:class:`Symfony\\Component\\DependencyInjection\\Exception\\ScopeWideningInjectionException`
260+
when passing the ``request`` service as an argument. To understand this
261+
problem better and learn how to solve it, refer to the cookbook article
262+
:doc:`/cookbook/service_container/scopes`.
263+
247264
The purpose of parameters is to feed information into services. Of course
248265
there was nothing wrong with defining the service without using any parameters.
249266
Parameters, however, have several advantages:

cookbook/configuration/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,4 @@ Configuration
99
external_parameters
1010
pdo_session_storage
1111
apache_router
12+
web_server_configuration
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
.. index::
2+
single: Web Server
3+
4+
Configuring a web server
5+
========================
6+
7+
The web directory is the home of all of your application's public and static
8+
files. Including images, stylesheets and JavaScript files. It is also where the
9+
front controllers live. For more details, see the :ref:`the-web-directory`.
10+
11+
The web directory services as the document root when configuring your web
12+
server. In the examples below, this directory is in ``/var/www/project/web/``.
13+
14+
Apache2
15+
-------
16+
17+
For advanced Apache configuration options, see the official `Apache`_
18+
documentation. The minimum basics to get your application running under Apache2
19+
are:
20+
21+
.. code-block:: apache
22+
23+
<VirtualHost *:80>
24+
ServerName www.domain.tld
25+
26+
DocumentRoot /var/www/project/web
27+
<Directory /var/www/project/web>
28+
# enable the .htaccess rewrites
29+
AllowOverride All
30+
Order allow,deny
31+
Allow from All
32+
</Directory>
33+
34+
ErrorLog /var/log/apache2/project_error.log
35+
CustomLog /var/log/apache2/project_access.log combined
36+
</VirtualHost>
37+
38+
.. note::
39+
40+
For performance reasons, you will probably want to set
41+
``AllowOverride None`` and implement the rewrite rules in the ``web/.htaccess``
42+
into the virtualhost config.
43+
44+
Nginx
45+
-----
46+
47+
For advanced Nginx configuration options, see the official `Nginx`_
48+
documentation. The minimum basics to get your application running under Nginx
49+
are:
50+
51+
.. code-block:: nginx
52+
53+
server {
54+
server_name www.domain.tld;
55+
root /var/www/project/web;
56+
57+
location / {
58+
# try to serve file directly, fallback to rewrite
59+
try_files $uri @rewriteapp;
60+
}
61+
62+
location @rewriteapp {
63+
# rewrite all to app.php
64+
rewrite ^(.*)$ /app.php/$1 last;
65+
}
66+
67+
location ~ ^/(app|app_dev)\.php(/|$) {
68+
fastcgi_pass unix:/var/run/php5-fpm.sock;
69+
fastcgi_split_path_info ^(.+\.php)(/.*)$;
70+
include fastcgi_params;
71+
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
72+
fastcgi_param HTTPS off;
73+
}
74+
75+
error_log /var/log/nginx/project_error.log;
76+
access_log /var/log/nginx/project_access.log;
77+
}
78+
79+
.. note::
80+
81+
Depending on your PHP-FPM config, the ``fastcgi_pass`` can also be
82+
``fastcgi_pass 127.0.0.1:9000``.
83+
84+
.. tip::
85+
86+
This executes **only** ``app.php`` and ``app_dev.php`` in the web directory.
87+
All other files will be served as text. If you have other PHP files in
88+
your web directory, be sure to include them in the ``location`` block
89+
above.
90+
91+
.. _`Apache`: http://httpd.apache.org/docs/current/mod/core.html#documentroot
92+
.. _`Nginx`: http://wiki.nginx.org/Symfony

cookbook/event_dispatcher/class_extension.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,7 @@ and *add* the method ``bar()``:
116116
}
117117
}
118118
119-
Finally, add the new ``bar`` method to the ``Foo`` class by register an
119+
Finally, add the new ``bar`` method to the ``Foo`` class by registering an
120120
instance of ``Bar`` with the ``foo.method_is_not_found`` event:
121121

122122
.. code-block:: php

cookbook/form/form_collections.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,9 +333,9 @@ new "tag" forms. To render it, make the following change to your template:
333333

334334
.. tip::
335335

336-
The ``form.tags.vars.prototype`` is form element that looks and feels just
336+
The ``form.tags.vars.prototype`` is a form element that looks and feels just
337337
like the individual ``form_widget(tag)`` elements inside your ``for`` loop.
338-
This means that you can call ``form_widget``, ``form_row``, or ``form_label``
338+
This means that you can call ``form_widget``, ``form_row`` or ``form_label``
339339
on it. You could even choose to render only one of its fields (e.g. the
340340
``name`` field):
341341

cookbook/map.rst.inc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
* :doc:`/cookbook/configuration/external_parameters`
2626
* :doc:`/cookbook/configuration/pdo_session_storage`
2727
* :doc:`/cookbook/configuration/apache_router`
28+
* :doc:`/cookbook/configuration/web_server_configuration`
2829

2930
* :doc:`/cookbook/console/index`
3031

@@ -108,6 +109,7 @@
108109
* :doc:`/cookbook/routing/redirect_in_config`
109110
* :doc:`/cookbook/routing/method_parameters`
110111
* :doc:`/cookbook/routing/service_container_parameters`
112+
* :doc:`/cookbook/routing/custom_route_loader`
111113

112114
* :doc:`/cookbook/security/index`
113115

0 commit comments

Comments
 (0)