<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="ru">
	<id>http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3AInstall_Moodle_On_Ubuntu_with_Nginx%2FPHP-fpm</id>
	<title>Development:Install Moodle On Ubuntu with Nginx/PHP-fpm - История изменений</title>
	<link rel="self" type="application/atom+xml" href="http://wiki.mipt.ru/index.php?action=history&amp;feed=atom&amp;title=Development%3AInstall_Moodle_On_Ubuntu_with_Nginx%2FPHP-fpm"/>
	<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Install_Moodle_On_Ubuntu_with_Nginx/PHP-fpm&amp;action=history"/>
	<updated>2026-05-07T17:30:54Z</updated>
	<subtitle>История изменений этой страницы в вики</subtitle>
	<generator>MediaWiki 1.42.1</generator>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:Install_Moodle_On_Ubuntu_with_Nginx/PHP-fpm&amp;diff=11254&amp;oldid=prev</id>
		<title>Олег Давидович: 1 версия импортирована</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Install_Moodle_On_Ubuntu_with_Nginx/PHP-fpm&amp;diff=11254&amp;oldid=prev"/>
		<updated>2024-10-21T08:51:21Z</updated>

		<summary type="html">&lt;p&gt;1 версия импортирована&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;ru&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;← Предыдущая версия&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Версия от 08:51, 21 октября 2024&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;ru&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(нет различий)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Олег Давидович</name></author>
	</entry>
	<entry>
		<id>http://wiki.mipt.ru/index.php?title=Development:Install_Moodle_On_Ubuntu_with_Nginx/PHP-fpm&amp;diff=11253&amp;oldid=prev</id>
		<title>1&gt;Jmouneyrac: /* PHP 5.3.3 */</title>
		<link rel="alternate" type="text/html" href="http://wiki.mipt.ru/index.php?title=Development:Install_Moodle_On_Ubuntu_with_Nginx/PHP-fpm&amp;diff=11253&amp;oldid=prev"/>
		<updated>2011-02-11T03:43:42Z</updated>

		<summary type="html">&lt;p&gt;&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;PHP 5.3.3&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Новая страница&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{stub}}This is a starting guide to install Moodle with Nginx/PHP-fpm/Postgres on the [http://releases.ubuntu.com/ latest Ubuntu LTS]. It is important to take note that Moodle is heavily tested on Apache2 environment, not on Nginx environment. This document is for people having previously installed a Moodle site and a Ubuntu distribution, and having some basic knowledge of Linux command lines (vim, linux permissions, compiling..).&lt;br /&gt;
&lt;br /&gt;
== Nginx ==&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
&lt;br /&gt;
sudo apt-get upgrade&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install python-software-properties&lt;br /&gt;
&lt;br /&gt;
sudo add-apt-repository ppa:nginx/stable&lt;br /&gt;
&lt;br /&gt;
sudo apt-get update&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install nginx&lt;br /&gt;
&lt;br /&gt;
sudo mkdir -p /home/nginx/localhost/{public,private,log,backup}&lt;br /&gt;
&lt;br /&gt;
sudo vim /etc/nginx/sites-available/default&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
server {&lt;br /&gt;
        root /home/nginx/localhost/public;&lt;br /&gt;
        index index.html index.htm index.php;&lt;br /&gt;
&lt;br /&gt;
        server_name yourdomainname.com;&lt;br /&gt;
&lt;br /&gt;
        location / {&lt;br /&gt;
                # First attempt to serve request as file, then&lt;br /&gt;
                # as directory, then fall back to index.html&lt;br /&gt;
                try_files $uri $uri/ /index.html;&lt;br /&gt;
        }&lt;br /&gt;
&lt;br /&gt;
        location ~ \.php$ {&lt;br /&gt;
                fastcgi_pass 127.0.0.1:9000;&lt;br /&gt;
                fastcgi_index index.php;&lt;br /&gt;
                include fastcgi_params;&lt;br /&gt;
        }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Postgres 9.0.3 ==&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install autoconf2.13 libssl-dev libcurl4-gnutls-dev libjpeg62-dev libpng12-dev  libmysql++-dev libfreetype6-dev libt1-dev libc-client-dev libevent-dev libxml2-dev libtool libmcrypt-dev&amp;lt;br/&amp;gt;&lt;br /&gt;
Note: also required to compiling PHP.&lt;br /&gt;
&lt;br /&gt;
cd /usr/local/src&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install build-essential libreadline6-dev zlib1g-dev&lt;br /&gt;
&lt;br /&gt;
wget http://wwwmaster.postgresql.org/redir/333/h/source/v9.0.3/postgresql-9.0.3.tar.gz&lt;br /&gt;
 &lt;br /&gt;
tar zxvf postgresql-9.0.3.tar.gz  &lt;br /&gt;
&lt;br /&gt;
cd postgresql-9.0.3&lt;br /&gt;
&lt;br /&gt;
./configure&lt;br /&gt;
&lt;br /&gt;
make&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo vim /etc/profile&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
Add to the end of /etc/profile:&lt;br /&gt;
export PATH=&amp;quot;/usr/local/pgsql/bin:${PATH}&amp;quot; &lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
source /etc/profile&lt;br /&gt;
&lt;br /&gt;
sudo adduser postgres&lt;br /&gt;
&lt;br /&gt;
sudo mkdir /usr/local/pgsql/data&lt;br /&gt;
&lt;br /&gt;
sudo chown postgres /usr/local/pgsql/data&lt;br /&gt;
&lt;br /&gt;
sudo su postgres&lt;br /&gt;
&lt;br /&gt;
/usr/local/pgsql/bin/initdb-E UTF8 -D /usr/local/pgsql/data&lt;br /&gt;
&lt;br /&gt;
/usr/local/pgsql/bin/pg_ctl start -D /usr/local/pgsql/data&lt;br /&gt;
&lt;br /&gt;
exit&lt;br /&gt;
&lt;br /&gt;
psql -U postgres&lt;br /&gt;
&lt;br /&gt;
\password&lt;br /&gt;
&lt;br /&gt;
createdb -E UTF8 -O postgres -T template0 -U postgres moodle&lt;br /&gt;
&lt;br /&gt;
\q&lt;br /&gt;
&lt;br /&gt;
== PHP 5.3.3 ==&lt;br /&gt;
Note: if you use postgres do not take PHP 5.3.5, pg_set_client_encoding() will crash with a http 500 error.&lt;br /&gt;
&lt;br /&gt;
sudo apt-get install libltdl-dev&lt;br /&gt;
&lt;br /&gt;
cd /usr/local/src&lt;br /&gt;
&lt;br /&gt;
sudo wget -O php-5.3.3.tar.gz http://us.php.net/get/php-5.3.3.tar.gz/from/us.php.net/mirror/&lt;br /&gt;
&lt;br /&gt;
tar zxvf php-5.3.3.tar.gz&lt;br /&gt;
&lt;br /&gt;
cd php-5.3.3&lt;br /&gt;
&lt;br /&gt;
./configure --enable-fpm --with-gd --with-mcrypt --enable-mbstring --with-openssl --with-jpeg-dir=/usr/lib --enable-gd-native-ttf --with-libxml-dir=/usr/lib --with-curl --enable-zip  --enable-sockets --with-zlib --enable-exif --enable-ftp --with-iconv --with-gettext --enable-gd-native-ttf --with-t1lib=/usr --with-freetype-dir=/usr --prefix=/usr/local/php --with-fpm-user=www-data --with-fpm-group=www-data --with-pgsql=/usr/local/pgsql --enable-tokenizer --with-xmlrpc --enable-soap --enable-ctype &lt;br /&gt;
&lt;br /&gt;
Note: this is to support postgres. TODO: intl extension is not enabled.&lt;br /&gt;
&lt;br /&gt;
sudo make&lt;br /&gt;
&lt;br /&gt;
sudo make install&lt;br /&gt;
&lt;br /&gt;
sudo cp php.ini-production /usr/local/php/lib/php.ini&lt;br /&gt;
&lt;br /&gt;
sudo chmod 644 /usr/local/php/lib/php.ini&lt;br /&gt;
&lt;br /&gt;
sudo cp /usr/local/php/etc/php-fpm.conf.default /usr/local/php/etc/php-fpm.conf&lt;br /&gt;
&lt;br /&gt;
sudo cp sapi/fpm/init.d.php-fpm /etc/init.d/php-fpm&lt;br /&gt;
&lt;br /&gt;
sudo chmod 755 /etc/init.d/php-fpm&lt;br /&gt;
&lt;br /&gt;
sudo update-rc.d -f php-fpm defaults&lt;br /&gt;
&lt;br /&gt;
sudo touch /var/run/php-fpm.pid&lt;br /&gt;
&lt;br /&gt;
sudo vim /etc/init.d/php-fpm&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
change location of pid (remove ${prefix}) to: &lt;br /&gt;
php_fpm_PID=/var/run/php-fpm.pid&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
sudo vim /usr/local/php/etc/php-fpm.conf&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
Changes these values&lt;br /&gt;
--------------------------------&lt;br /&gt;
pid = /var/run/php-fpm.pid&lt;br /&gt;
error_log = /var/log/php-fpm.log&lt;br /&gt;
--------------------------------&lt;br /&gt;
Uncomment the lines for:&lt;br /&gt;
-------------------------&lt;br /&gt;
pm.start_servers = 20&lt;br /&gt;
pm.min_spare_servers = 5&lt;br /&gt;
pm.max_spare_servers = 35&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
sudo service php-fpm start&lt;br /&gt;
&lt;br /&gt;
sudo /etc/init.d/nginx restart&lt;br /&gt;
&lt;br /&gt;
vim /home/nginx/localhost/public/index.php&lt;br /&gt;
&amp;lt;code bash&amp;gt;&lt;br /&gt;
Enter:&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
phpinfo();&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Check it is available.&lt;br /&gt;
&lt;br /&gt;
== APC ==&lt;br /&gt;
With APC, Moodle will be a lot faster.&lt;br /&gt;
&lt;br /&gt;
sudo /usr/local/php/bin/pecl config-set php_ini /usr/local/php/lib/php.ini&lt;br /&gt;
&lt;br /&gt;
sudo /usr/local/php/bin/pecl install apc&lt;br /&gt;
&lt;br /&gt;
sudo vim /usr/local/php/lib/php.ini&lt;br /&gt;
add (if not already existing): extension=apc.so&lt;br /&gt;
&lt;br /&gt;
== Moodle ==&lt;br /&gt;
[https://docs.moodle.org/en/Installing_Moodle Install Moodle] into  /home/nginx/localhost/public/. Note that it is recommended to install Git and to get the Moodle files with Git.&lt;br /&gt;
&lt;br /&gt;
In the Moodle administration, disable &amp;#039;slash arguments&amp;#039; (http://YOURMOODLESITE/admin/search.php?query=slashargument).&lt;br /&gt;
&lt;br /&gt;
== More to do ==&lt;br /&gt;
* follow [https://docs.moodle.org/en/Security Moodle security page]&lt;br /&gt;
* Secure SSH (see this [http://articles.slicehost.com/2009/3/31/debian-lenny-setup-page-1 slicehost debian setup page])&lt;br /&gt;
* Enable SSL (you can use [http://blurringexistence.net/archives/5-nginx-and-StartSSL.html to install a free SSL certificate with startSSL])&lt;br /&gt;
* Setup firewall ([http://ubuntuforums.org/showthread.php?t=159661 ubuntu documentation])&lt;br /&gt;
* Install SMTP server ([https://help.ubuntu.com/community/Postfix Ubuntu documentation with working main.cf], [http://library.linode.com/email/postfix/dovecot-system-users-ubuntu-10.04-lucid Linode documentation], [http://helpdesk.bluehost.com/index.php/kb/article/000294 documentation about MX-record])&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
There are still a lot more to do (setting up your domain name, establishing a maintenance plan, performance tweaking, security testing...). Be patient and have fun.&lt;br /&gt;
&lt;br /&gt;
== Related document ==&lt;br /&gt;
* Nginx/PHP-fpm [http://bestsiteinthemultiverse.com/2011/01/installing-nginx-with-php-fpm-on-ubuntu-10-04/ blog post]&lt;br /&gt;
* Compiling Postgres 9 [http://www.johnwulff.com/2010/05/04/how-to-compile-and-install-postgresql-9-beta-on-ubuntu blog post]&lt;/div&gt;</summary>
		<author><name>1&gt;Jmouneyrac</name></author>
	</entry>
</feed>