Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Sign in
Toggle navigation
S
Silex
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
common
Silex
Commits
4d106637
Commit
4d106637
authored
Jun 16, 2012
by
Fabien Potencier
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
moved web server configuration info to its own chapter
parent
074a1152
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
89 additions
and
88 deletions
+89
-88
doc/index.rst
doc/index.rst
+1
-0
doc/usage.rst
doc/usage.rst
+2
-88
doc/web_servers.rst
doc/web_servers.rst
+86
-0
No files found.
doc/index.rst
View file @
4d106637
...
...
@@ -13,5 +13,6 @@ Silex
internals
contributing
providers/index
web_servers
changelog
phar
doc/usage.rst
View file @
4d106637
...
...
@@ -61,8 +61,8 @@ definitions, call the ``run`` method on your application::
$app->run();
Then, you have to configure your web server (read
below hints for Apache and
IIS
).
Then, you have to configure your web server (read
the dedicated chapter for
more information
).
.. tip::
...
...
@@ -768,90 +768,4 @@ to prevent Cross-Site-Scripting attacks.
return $app->json(array('name' => $name));
});
Webserver configuration
-----------------------
Apache
~~~~~~
If you are using Apache you can use a ``.htaccess`` file for this:
.. code-block:: apache
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
#RewriteBase /path/to/app
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
.. note::
If your site is not at the webroot level you will have to uncomment the
``RewriteBase`` statement and adjust the path to point to your directory,
relative from the webroot.
Alternatively, if you use Apache 2.2.16 or higher, you can use the
`FallbackResource directive`_ so make your .htaccess even easier:
.. code-block:: apache
FallbackResource index.php
nginx
~~~~~
If you are using nginx, configure your vhost to forward non-existent
resources to ``index.php``:
.. code-block:: nginx
server {
index index.php
location / {
try_files $uri $uri/ /index.php;
}
location ~ index\.php$ {
fastcgi_pass /var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
IIS
~~~
If you are using the Internet Information Services from Windows, you can use
this sample ``web.config`` file:
.. code-block:: xml
<?xml version="1.0"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Silex Front Controller" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
.. _FallbackResource directive: http://www.adayinthelifeof.nl/2012/01/21/apaches-fallbackresource-your-new-htaccess-command/
.. _download: http://silex.sensiolabs.org/download
doc/web_servers.rst
0 → 100644
View file @
4d106637
Webserver Configuration
=======================
Apache
------
If you are using Apache you can use a ``.htaccess`` file for this:
.. code-block:: apache
<IfModule mod_rewrite.c>
Options -MultiViews
RewriteEngine On
#RewriteBase /path/to/app
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
.. note::
If your site is not at the webroot level you will have to uncomment the
``RewriteBase`` statement and adjust the path to point to your directory,
relative from the webroot.
Alternatively, if you use Apache 2.2.16 or higher, you can use the
`FallbackResource directive`_ so make your .htaccess even easier:
.. code-block:: apache
FallbackResource index.php
nginx
-----
If you are using nginx, configure your vhost to forward non-existent
resources to ``index.php``:
.. code-block:: nginx
server {
index index.php
location / {
try_files $uri $uri/ /index.php;
}
location ~ index\.php$ {
fastcgi_pass /var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
IIS
---
If you are using the Internet Information Services from Windows, you can use
this sample ``web.config`` file:
.. code-block:: xml
<?xml version="1.0"?>
<configuration>
<system.webServer>
<defaultDocument>
<files>
<clear />
<add value="index.php" />
</files>
</defaultDocument>
<rewrite>
<rules>
<rule name="Silex Front Controller" stopProcessing="true">
<match url="^(.*)$" ignoreCase="false" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" ignoreCase="false" negate="true" />
</conditions>
<action type="Rewrite" url="index.php" appendQueryString="true" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
.. _FallbackResource directive: http://www.adayinthelifeof.nl/2012/01/21/apaches-fallbackresource-your-new-htaccess-command/
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment