November 10

Moodle/Nginx install on Centos .6.6
cat /etc/sysconfig/network-scripts/ifcfg-eth0 first make sure ethernet card is setup on boot:

to make sure you have :  ONBOOT = “yes”

sudo yum install rpm-build
yum install wget
cd /usr/local/src
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
cd /etc/yum.repos.d
  add in the repo to grab latest nginx vi nginx.repo:
     name=nginx repo
  vi remi.repo
     set [remi]  enabled = 1  AND [remi-php55] enabled = 1 AND [remi-php55-debuginfo] enabled=1
yum update -y
yum install php php-fpm php-gd php-mbstring php-mcrypt php-mysql php-apc php-common php-curl php-intl php-soap php-xmlrpc  -y
yum --enablerepo=remi list mysql mysql-server
yum install git mysql mysql-server -y

vi /etc/php-fpm.d/www*

listen = /tmp/php5-fpm.sock
listen.owner = nginx =nginx
user =nginx
group =nginx

vi /etc/php.ini

  • cgi.fix_pathinfo=1
  • add opcache:
    opcache.revalidate_freq = 60
    ; Required for Moodle
    opcache.save_comments = 1
    opcache.enable_file_override = 0
  • ; If something does not work in Moodle
    ;opcache.revalidate_path = 1 ; May fix problems with include paths
    ;opcache.mmap_base = 0x20000000 ; (Windows only) fix OPcache crashes with event id 487; Experimental for Moodle 2.6 and later
    ;opcache.fast_shutdown = 1
    ;opcache.enable_cli = 1 ; Speeds up CLI cron
    ;opcache.load_comments = 0 ; May lower memory use, might not be compatible with add-ons and other apps.

intall nginX:

yum install nginx

intall moodle:

  • mkdir /usr/local/src cd /usr/local/src
  • get url for moodle from https:/
  • wget
  • unzip
  • mkdir /var/www/
  • mv moodle/* /var/www/
  • chown nginx:adm
  • chmod 755
  • mkdir /var/www/moodledata
  • chown nginx:adm moodledata -R
  • chmod 755 moodledata -R
  • update config  with sql user/pass and moodledata path at /var/www/moodlesite/config-dist.php

nginx configuration:

rewrite ^/(.*.php)(/)(.*)$ /$1?file=/$3 last;

vi /etc/nginx/conf.d/



server {
root /var/www/;
#access_log logs/;
#error_log logs/ crit;

listen 80;

location / {
index index.php index.html index.htm;

# moodle rewrite rules
rewrite ^/(.*.php)(/)(.*)$ /$1?file=/$3 last;

# php parsing
location ~ .php$ {
try_files $uri =404;
fastcgi_pass unix:/tmp/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
fastcgi_buffer_size 128k;
fastcgi_buffers 256 4k;
fastcgi_busy_buffers_size 256k;
fastcgi_temp_file_write_size 256k;


service mysqld restart
mysql -u root
SET PASSWORD FOR 'root'@'localhost' = PASSWORD('password');
chkconfig --levels 235 mysqld on
chkconfig --levels 235 nginx on
chkconfig --levels 235 php-fpm on
service nginx restart
service php-fpm restart

see next post for certs

Posted November 10, 2014 by astro_sk in category "applications", "web

Warning: count(): Parameter must be an array or an object that implements Countable in /home/ezyjvz6btjbi/domains/ on line 399

Leave a Reply

Your email address will not be published. Required fields are marked *