Moodle/Nginx install on Centos .6.6
http://mirror.hmc.edu/centos/6.6/isos/x86_64/CentOS-6.6-x86_64-minimal.iso
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 wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm 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: #nginx.repo [nginx] name=nginx repo baseurl=http://nginx.org/packages/centos/6/$basearch gpgcheck=0 enabled=1 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 listen.group =nginx user =nginx group =nginx
vi /etc/php.ini
- cgi.fix_pathinfo=1
- add opcache:
[opcache]
opcache.enable=1
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq = 60
opcache.max_wasted_percentage=5
; Required for Moodle
opcache.use_cwd=1
opcache.validate_timestamps=1
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:/download.moodle.org/local/downloadmoodleorg/stats.php
- wget http://download.moodle.org/download.php/direct/moodle/moodle-latest.zip
- unzip moodle-latest.zip
- mkdir /var/www/yoursite.com/
- mv moodle/* /var/www/yoursite.com/
- chown nginx:adm yoursite.com
- chmod 755 yoursite.com
- 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/yoursite.com.conf
### yourwebsite.com server { root /var/www/yourwebsite.com; #access_log logs/yourwebsite.com-access_log; #error_log logs/yourwebsite.com-error_log crit; listen 80; server_name yourwebsite.com www.yourwebsite.com; 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
');
exit;
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