Skip to content

Commit 2a5369c

Browse files
committed
Update server configuration for Symfony 4
1 parent 2ee2ce2 commit 2a5369c

File tree

1 file changed

+6
-24
lines changed

1 file changed

+6
-24
lines changed

setup/web_server_configuration.rst

Lines changed: 6 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ to use PHP :ref:`with Nginx <web-server-nginx>`.
1919

2020
The web directory is the home of all of your application's public and
2121
static files, including images, stylesheets and JavaScript files. It is
22-
also where the front controllers (``index.php`` and ``index.php``) live.
22+
also where the front controller (``index.php``) lives.
2323

2424
The web directory serves as the document root when configuring your
2525
web server. In the examples below, the ``public/`` directory will be the
@@ -270,25 +270,8 @@ The **minimum configuration** to get your application running under Nginx is:
270270
# try to serve file directly, fallback to index.php
271271
try_files $uri /index.php$is_args$args;
272272
}
273-
# DEV
274-
# This rule should only be placed on your development environment
275-
# In production, don't include this and don't deploy index.php or config.php
276-
location ~ ^/(app_dev|config)\.php(/|$) {
277-
fastcgi_pass unix:/var/run/php7.1-fpm.sock;
278-
fastcgi_split_path_info ^(.+\.php)(/.*)$;
279-
include fastcgi_params;
280-
# When you are using symlinks to link the document root to the
281-
# current version of your application, you should pass the real
282-
# application path instead of the path to the symlink to PHP
283-
# FPM.
284-
# Otherwise, PHP's OPcache may not properly detect changes to
285-
# your PHP files (see https://github.com/zendtech/ZendOptimizerPlus/issues/126
286-
# for more information).
287-
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
288-
fastcgi_param DOCUMENT_ROOT $realpath_root;
289-
}
290-
# PROD
291-
location ~ ^/app\.php(/|$) {
273+
274+
location ~ ^/index\.php(/|$) {
292275
fastcgi_pass unix:/var/run/php7.1-fpm.sock;
293276
fastcgi_split_path_info ^(.+\.php)(/.*)$;
294277
include fastcgi_params;
@@ -324,17 +307,16 @@ The **minimum configuration** to get your application running under Nginx is:
324307

325308
.. tip::
326309

327-
This executes **only** ``index.php``, ``index.php`` and ``config.php`` in
328-
the web directory. All other files ending in ".php" will be denied.
310+
This executes **only** ``index.php`` in the web directory. All other files
311+
ending in ".php" will be denied.
329312

330313
If you have other PHP files in your web directory that need to be executed,
331314
be sure to include them in the ``location`` block above.
332315

333316
.. caution::
334317

335318
After you deploy to production, make sure that you **cannot** access the ``index.php``
336-
or ``config.php`` scripts (i.e. ``http://example.com/index.php`` and ``http://example.com/config.php``).
337-
If you *can* access these, be sure to remove the ``DEV`` section from the above configuration.
319+
script (i.e. ``http://example.com/index.php``).
338320

339321
.. note::
340322

0 commit comments

Comments
 (0)