<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://docs.moodle.org/34/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Maurits</id>
	<title>MoodleDocs - User contributions [en]</title>
	<link rel="self" type="application/atom+xml" href="https://docs.moodle.org/34/en/api.php?action=feedcontributions&amp;feedformat=atom&amp;user=Maurits"/>
	<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/Special:Contributions/Maurits"/>
	<updated>2026-05-15T15:11:47Z</updated>
	<subtitle>User contributions</subtitle>
	<generator>MediaWiki 1.43.5</generator>
	<entry>
		<id>https://docs.moodle.org/34/en/index.php?title=Nginx&amp;diff=118808</id>
		<title>Nginx</title>
		<link rel="alternate" type="text/html" href="https://docs.moodle.org/34/en/index.php?title=Nginx&amp;diff=118808"/>
		<updated>2015-06-13T09:07:39Z</updated>

		<summary type="html">&lt;p&gt;Maurits: Adding a remark that the alias should end with a /, otherwise it won&amp;#039;t work&lt;/p&gt;
&lt;hr /&gt;
&lt;div&gt;{{Installing Moodle}}[[Nginx]] [engine x] is an HTTP and reverse proxy server, as well as a mail proxy server, written by Igor Sysoev. The nginx project started with a strong focus on high concurrency, high performance and low memory usage. It is licensed under the 2-clause BSD-like license and it runs on Linux, BSD variants, Mac OS X, Solaris, AIX, HP-UX, as well as on other *nix flavors. It also has a proof of concept port for Microsoft Windows.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;The following is community-contributed documentation on Nginx configuration. Amendmends and additions are welcome.&#039;&#039;&lt;br /&gt;
&lt;br /&gt;
== Nginx configuration ==&lt;br /&gt;
&lt;br /&gt;
=== PHP-FPM ===&lt;br /&gt;
&lt;br /&gt;
Nginx is usually configured to interface with PHP via [http://php.net/manual/en/install.fpm.php php-fpm]. This is both fast and robust.&lt;br /&gt;
&lt;br /&gt;
==== php.ini ====&lt;br /&gt;
Typically the php-fpm daemon with have it&#039;s own php.ini e.g. in debian it is /etc/php5/fpm/php.ini. The following setting is required,&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;php.ini&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
cgi.fix_pathinfo=0&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Nginx ===&lt;br /&gt;
&lt;br /&gt;
====Slasharguments====&lt;br /&gt;
Add the following &#039;slash arguments&#039; compatible (see [[Using slash arguments]]) &#039;location&#039; block to your vhosts &#039;server&#039; configuration in your nginx configuration.&lt;br /&gt;
&lt;br /&gt;
&#039;&#039;&#039;nginx.conf location:&#039;&#039;&#039;&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
location ~ [^/]\.php(/|$) {&lt;br /&gt;
    # NOTE: You should have &amp;quot;cgi.fix_pathinfo = 0;&amp;quot; in php.ini&lt;br /&gt;
    fastcgi_split_path_info  ^(.+\.php)(/.+)$;&lt;br /&gt;
    fastcgi_index            index.php;&lt;br /&gt;
    fastcgi_pass             127.0.0.1:9000 (or your php-fpm socket);&lt;br /&gt;
    include                  fastcgi_params;&lt;br /&gt;
    fastcgi_param   PATH_INFO       $fastcgi_path_info;&lt;br /&gt;
    fastcgi_param   SCRIPT_FILENAME $document_root$fastcgi_script_name;&lt;br /&gt;
&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
&lt;br /&gt;
==== XSendfile aka X-Accel-Redirect ====&lt;br /&gt;
&lt;br /&gt;
Setting Moodle and Nginx to use XSendfile functionality is a big win as it frees PHP from delivering files allowing Nginx to do what it does best, i.e. deliver files. &lt;br /&gt;
&lt;br /&gt;
Enable xsendfile for Nginx in Moodles config.php, this is documented in the config-dist.php, a minimal configuration look like this,&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
$CFG-&amp;gt;xsendfile = &#039;X-Accel-Redirect&#039;;&lt;br /&gt;
$CFG-&amp;gt;xsendfilealiases = array(&lt;br /&gt;
    &#039;/dataroot/&#039; =&amp;gt; $CFG-&amp;gt;dataroot&lt;br /&gt;
);&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
Accompany this with a matching &#039;location&#039; block in your nginx server configuration.&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
location /dataroot/ {&lt;br /&gt;
    internal;&lt;br /&gt;
    alias &amp;amp;lt;full_moodledata_path&amp;amp;gt;; #make sure the path ends with /&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;br /&gt;
The definition of &#039;internal&#039; here is important as it prevents client access to your dataroot.&lt;br /&gt;
&lt;br /&gt;
== See also ==&lt;br /&gt;
&lt;br /&gt;
* Real &amp;lt;tt&amp;gt;PATH_INFO&amp;lt;/tt&amp;gt; support:&lt;br /&gt;
** https://moodle.org/mod/forum/discuss.php?d=278916&lt;br /&gt;
** https://moodle.org/mod/forum/discuss.php?d=307388&lt;br /&gt;
* Internal rewriting to the HTTP GET &amp;lt;tt&amp;gt;file&amp;lt;/tt&amp;gt; parameter:&lt;br /&gt;
** https://docs.moodle.org/dev/Install_Moodle_On_Ubuntu_with_Nginx/PHP-fpm&lt;br /&gt;
** https://moodle.org/mod/forum/discuss.php?d=83445&lt;br /&gt;
&lt;br /&gt;
[[Category:Installation]]&lt;br /&gt;
&lt;br /&gt;
[[es:Nginx]]&lt;/div&gt;</summary>
		<author><name>Maurits</name></author>
	</entry>
</feed>