{"id":4657,"date":"2019-08-30T15:20:28","date_gmt":"2019-08-30T15:20:28","guid":{"rendered":"http:\/\/myprojects.advchaweb.com\/?p=4657"},"modified":"2019-08-31T14:06:12","modified_gmt":"2019-08-31T14:06:12","slug":"moodle","status":"publish","type":"post","link":"https:\/\/myprojects.advchaweb.com\/index.php\/2019\/08\/30\/moodle\/","title":{"rendered":"Moodle"},"content":{"rendered":"<p>Download opencart from https:\/\/www.moodle.org<br \/>\nThen extract it in your root web directory<br \/>\nRead INSTALL.txt file to setup and install moodle<\/p>\n<p>Setup with Nginx<\/p>\n<pre class=\"lang:default decode:true\">teddy@teddy:~\/Documents\/works\/moodle\/upload$ sudo gedit \/etc\/nginx\/sites-available\/moodle.test<\/pre>\n<p>Here is the content<\/p>\n<pre class=\"lang:default decode:true\">server {\r\n    listen 80;\r\n    listen [::]:80;\r\n    root \/home\/teddy\/Documents\/works\/moodle;\r\n    index  index.php index.html index.htm;\r\n    server_name www.moodle.test moodle.test;\r\n\r\n    error_log \/home\/teddy\/Documents\/works\/moodle\/var\/log\/moodle_errors.log; \r\n    access_log \/home\/teddy\/Documents\/works\/moodle\/var\/log\/moodle_access.log;\r\n\r\n    location \/ {\r\n        try_files $uri $uri\/ =404;        \r\n    }\r\n \r\n    location \/dataroot\/ {\r\n        internal;\r\n        alias \/home\/teddy\/Documents\/works\/moodledata\/;\r\n    }\r\n\r\n    location ~ [^\/]\\.php(\/|$) {\r\n        include snippets\/fastcgi-php.conf;\r\n        fastcgi_pass unix:\/run\/php\/php7.2-fpm.sock;\r\n        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;\r\n        include fastcgi_params;\r\n    }\r\n\r\n    gzip on;\r\n    gzip_disable \"msie6\";\r\n\r\n    gzip_comp_level 6;\r\n    gzip_min_length 1100;\r\n    gzip_buffers 16 8k;\r\n    gzip_proxied any;\r\n    gzip_types\r\n    text\/plain\r\n    text\/css\r\n    text\/js\r\n    text\/xml\r\n    text\/javascript\r\n    application\/javascript\r\n    application\/x-javascript\r\n    application\/json\r\n    application\/xml\r\n    application\/xml+rss\r\n    image\/svg+xml;\r\n    gzip_vary on;\r\n}<\/pre>\n<p>NOTE: Pay attention on these lines<\/p>\n<pre class=\"lang:default decode:true \">    location \/dataroot\/ {\r\n        internal;\r\n        alias \/home\/teddy\/Documents\/works\/moodledata\/;\r\n    }<\/pre>\n<p>I HAVE TO PUT THEM THERE. IF NOT, I&#8217;D GET SESSION PROBLEM AND THE STATIC FILES (JS AND CSS) PATH WOULD NOT BE RECOGNIZED<br \/>\nREF: https:\/\/www.sudutbaca.com\/cara-install-moodle-di-debian-9-menggunakan-nginx-mariadb-php7-2-fpm\/<\/p>\n<p>XXXdon&#8217;t forget to create the log file in var\/log\/system.log<br \/>\nThen<\/p>\n<pre class=\"lang:default decode:true\">teddy@teddy:~\/Documents\/works\/moodle$ sudo ln -s \/etc\/nginx\/sites-available\/moodle.test \/etc\/nginx\/sites-enabled\/moodle.test<\/pre>\n<p>Then<\/p>\n<pre class=\"lang:default decode:true\">teddy@teddy:~\/Documents\/works\/moodle$ sudo gedit \/etc\/hosts<\/pre>\n<p>Insert this line:<\/p>\n<pre class=\"lang:default decode:true\">...\r\n127.0.0.1 \tmoodle.test\r\n...<\/pre>\n<p>Then check the nginx config and restart nginx<\/p>\n<pre class=\"lang:default decode:true\">teddy@teddy:~\/Documents\/works\/moodle$ sudo nginx -t\r\nnginx: [warn] conflicting server name \"\" on 0.0.0.0:80, ignored\r\nnginx: the configuration file \/etc\/nginx\/nginx.conf syntax is ok\r\nnginx: configuration file \/etc\/nginx\/nginx.conf test is successful\r\nteddy@teddy:~\/Documents\/works\/moodle$ sudo service nginx restart<\/pre>\n<p>Set the files owner<\/p>\n<pre class=\"lang:default decode:true\">teddy@teddy:~\/Documents\/works\/moodle$ sudo chown www-data:www-data -R .<\/pre>\n<p>Open it on your browser http:\/\/moodle.test. For the first time, it&#8217;ll install Moodle.<\/p>\n<pre class=\"lang:default decode:true \">Web address: http:\/\/moodle.test\r\nMoodle directory: \/home\/teddy\/Documents\/works\/moodle\r\nData directory: \/home\/teddy\/Documents\/works\/moodledata\r\n<\/pre>\n<p>Note: Create a new database &#8216;moodle&#8217; with collation &#8216;utf8mb4_general_ci&#8217;<br \/>\nI THINK I ALSO NEED TO CHANGE (NOT SURE) config.php THEN ADD THESE NEW LINES<\/p>\n<pre class=\"lang:default decode:true \">...\r\n$CFG-&gt;xsendfile = 'X-Accel-Redirect';\r\n$CFG-&gt;xsendfilealiases = array(\r\n    '\/dataroot\/' =&gt; $CFG-&gt;dataroot\r\n);\r\n\r\nrequire_once(__DIR__ . '\/lib\/setup.php');\r\n...<\/pre>\n<p>&nbsp;<\/p>\n<p>Admin:<br \/>\n<span class=\"rcp-restricted-content-message\">SORRY, ONLY ADMIN CAN SHOW THIS!<\/span><br \/>\nAdmin page: http:\/\/moodle.test\/my\/<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Download opencart from https:\/\/www.moodle.org Then extract it in your root web directory Read INSTALL.txt file to setup and install moodle Setup with Nginx teddy@teddy:~\/Documents\/works\/moodle\/upload$ sudo gedit \/etc\/nginx\/sites-available\/moodle.test Here is the content server { listen 80; listen [::]:80; root \/home\/teddy\/Documents\/works\/moodle; index index.php index.html index.htm; server_name www.moodle.test moodle.test; error_log \/home\/teddy\/Documents\/works\/moodle\/var\/log\/moodle_errors.log; access_log \/home\/teddy\/Documents\/works\/moodle\/var\/log\/moodle_access.log; location \/ { try_files $uri &hellip; <a href=\"https:\/\/myprojects.advchaweb.com\/index.php\/2019\/08\/30\/moodle\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Moodle&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[56],"tags":[],"class_list":["post-4657","post","type-post","status-publish","format-standard","hentry","category-moodle"],"_links":{"self":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/4657","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/comments?post=4657"}],"version-history":[{"count":6,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/4657\/revisions"}],"predecessor-version":[{"id":4664,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/posts\/4657\/revisions\/4664"}],"wp:attachment":[{"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/media?parent=4657"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/categories?post=4657"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/myprojects.advchaweb.com\/index.php\/wp-json\/wp\/v2\/tags?post=4657"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}