Showing posts with label nginx. Show all posts
Showing posts with label nginx. Show all posts

Thursday, 2 July 2026

cek error 500

 

Karena yang muncul adalah HTTP 500 Internal Server Error, berarti ada fatal error PHP, bukan error routing. File izin_guru.php memang ada di plugin Anda, sehingga penyebabnya hampir pasti berasal dari kode yang baru diubah.

Langkah tercepat adalah melihat error sebenarnya.

Jalankan di server:

tail -50 /var/log/apache2/error.log

atau jika memakai PHP-FPM:

tail -50 /var/log/php8.2-fpm.log

atau jika menggunakan Nginx:

tail -50 /var/log/nginx/error.log

Kalau Moodle mengaktifkan debugging, Anda juga bisa:

$CFG->debug = (E_ALL | E_STRICT);
$CFG->debugdisplay = 1;

atau melalui Site administration → Development → Debugging.

Berdasarkan perubahan yang kita lakukan sebelumnya

Kemungkinan terbesar ada pada blok notifikasi WA yang baru ditambahkan, misalnya:

  • ada koma yang hilang pada array,

  • ada kurung } atau ) yang tidak seimbang,

  • memanggil fungsi yang belum ada,

  • atau ada syntax error setelah penambahan:

jm_kirim_template_auto(...)

atau

$datawa = [
    ...
];

Agar bisa langsung saya temukan

Tolong kirim salah satu dari berikut:

  1. Isi file izin_guru.php terbaru, atau minimal bagian yang baru Anda ubah (terutama blok notifikasi WA), atau

  2. Hasil:

php -l /var/www/html/moodle/local/jurnalmengajar/izin_guru.php

Perintah php -l biasanya langsung menunjukkan:

Parse error:
Fatal error:
Unexpected ...
on line ...

sehingga kita bisa menemukan letak error dalam hitungan menit.

Friday, 5 June 2026

sites available wates dan anjir 2 situ dalam armbian

 root@aml-s9xx-box:~# ls -lh /etc/nginx/sites-enabled/
total 0
lrwxrwxrwx 1 root root 37 Jun  4 20:33 data-murid -> /etc/nginx/sites-available/data-murid
lrwxrwxrwx 1 root root 34 May 10 11:25 situs_a -> /etc/nginx/sites-available/situs_a
lrwxrwxrwx 1 root root 34 May 10 18:00 situs_b -> /etc/nginx/sites-available/situs_b
root@aml-s9xx-box:~# cat /etc/nginx/sites-enabled/situs_a
server {
    listen 80;
    listen [::]:80;
    server_name anjir.simsdn.my.id;

    root /var/www/situs_a/moodle;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php(/|$) {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;

        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }
}
root@aml-s9xx-box:~# cat /etc/nginx/sites-enabled/situs_b
server {
    listen 8080;
    server_name sman1wates.jurnaldo.my.id;

    root /var/www/situs_b/moodle;
    index index.php index.html;

    # 🔥 WAJIB untuk Moodle
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # 🔥 FIX utama (support slasharguments)
    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;

        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }

    # 🔥 Optional (biar static file lebih cepat)
    location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff|woff2|ttf|svg)$ {
        expires max;
        log_not_found off;
    }
}
root@aml-s9xx-box:~# cat /etc/nginx/sites-available/data-murid
server {
    listen 8081;
    server_name murid_paduan.jurnaldo.my.id;

    root /var/www/data-murid;
    index index.html;
   
    access_log /var/log/nginx/data-murid-access.log;
    error_log  /var/log/nginx/data-murid-error.log;

    location / {
        try_files $uri $uri/ =404;
    }
}

Sunday, 26 April 2026

Buat 2 moodle dalam 1 mesin instance

 **buat folder
mkdir -p /var/www/shared/local

**pindah kode
mv /var/www/html/moodle/local/jurnalmengajar /var/www/shared/local/

**buat symlink kepada 2 moodle:
ln -s /var/www/shared/local/jurnalmengajar \
/var/www/situs_a/moodle/local/jurnalmengajar

ln -s /var/www/shared/local/jurnalmengajar \
/var/www/situs_b/moodle/local/jurnalmengajar

**atur permission
chown -R www-data:www-data /var/www/shared/local/jurnalmengajar
chmod -R 755 /var/www/shared/local/jurnalmengajar

**upgrade masing-masing
php /var/www/situs_a/moodle/admin/cli/upgrade.php
php /var/www/situs_b/moodle/admin/cli/upgrade.php

⚠️ HAL PENTING (JANGAN SAMPAI TERLEWAT)
1. Database tetap beda
a → database a
b → database b
👉 supaya tidak merusak data asli

2. moodledata beda
Contoh:
/var/moodledata_a
/var/moodledata_b

3. config.php beda

Cek:
situs_a ; /var/www/situs_a/moodle/config.php
$CFG->dirroot = '/var/www/situs_a/moodle';

situs_b ; /var/www/situs_b/moodle/config.php
$CFG->dirroot = '/var/www/situs_b/moodle';

** SET PERMISSION
chown -R www-data:www-data /var/moodledata_a
chown -R www-data:www-data /var/moodledata_b

chmod -R 755 /var/moodledata_a
chmod -R 755 /var/moodledata_b

** CONFIG situs_a**
# cat /var/www/situs_a/moodle/config.php
<?php  // config.php

unset($CFG);
global $CFG;
$CFG = new stdClass();

// ----------------------
// Konfigurasi database
// ----------------------
$CFG->dbtype    = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle_a';
$CFG->dbuser    = 'user_a';
$CFG->dbpass    = 'password_a';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array(
    'dbpersist' => 0,
    'dbport' => '',
    'dbsocket' => '',
    'dbcollation' => 'utf8mb4_unicode_ci',
);

// Jika Anda ingin paksa wwwroot tertentu, uncomment baris di bawah ini dan sesuaikan:
$CFG->wwwroot   = 'https://situs_a';
$CFG->sslproxy  = true;
//$CFG->reverseproxy = true;

// ----------------------
// Path Moodle
// ----------------------
//$CFG->dataroot  = '/var/moodledata';
$CFG->dataroot = '/var/moodledata_a';
$CFG->admin     = 'admin';

// Umum
$CFG->directorypermissions = 0777;

// Debugging (aktifkan sementara saat troubleshooting)
//@error_reporting(E_ALL | E_STRICT);
//@ini_set('display_errors', '1');
//$CFG->debug = (E_ALL | E_STRICT);
//$CFG->debugdisplay = 1;

require_once(__DIR__ . '/lib/setup.php');

==============================================================
** CONFIG situs-B **
==============================================================

# cat /var/www/situs_b/moodle/config.php
<?php  // config.php

unset($CFG);
global $CFG;
$CFG = new stdClass();

// ----------------------
// Konfigurasi database
// ----------------------
$CFG->dbtype    = 'mariadb';
$CFG->dblibrary = 'native';
$CFG->dbhost    = 'localhost';
$CFG->dbname    = 'moodle_b';
$CFG->dbuser    = 'moodluser_b';
$CFG->dbpass    = 'password_b';
$CFG->prefix    = 'mdl_';
$CFG->dboptions = array(
    'dbpersist' => 0,
    'dbport' => '',
    'dbsocket' => '',
    'dbcollation' => 'utf8mb4_unicode_ci',
);

// Jika Anda ingin paksa wwwroot tertentu, uncomment baris di bawah ini dan sesuaikan:
$CFG->wwwroot   = 'https://situs_b';
$CFG->sslproxy  = true;
//$CFG->reverseproxy = true;
// 🔥 TAMBAHKAN INI
$CFG->sessioncookie = 'MoodleSessionDEV';

// ----------------------
// Path Moodle
// ----------------------
//$CFG->dataroot  = '/var/moodledata';
$CFG->dataroot = '/var/moodledata_b';
$CFG->admin     = 'admin';

// Umum
$CFG->directorypermissions = 0777;

// Debugging (aktifkan sementara saat troubleshooting)
//@error_reporting(E_ALL | E_STRICT);
//@ini_set('display_errors', '1');
//$CFG->debug = (E_ALL | E_STRICT);
//$CFG->debugdisplay = 1;

require_once(__DIR__ . '/lib/setup.php');


=======================================
nginx site availabel
=======================================
# cat /etc/nginx/sites-available/situs_a
server {
    listen 80;
    listen [::]:80;
    server_name situs_a;

    root /var/www/situs_a/moodle;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php(/|$) {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;

        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }
}


=============================
# cat /etc/nginx/sites-available/situs_b
server {
    listen 8080;
    server_name situs_b;

    root /var/www/situs_b/moodle;
    index index.php index.html;

    # 🔥 WAJIB untuk Moodle
    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    # 🔥 FIX utama (support slasharguments)
    location ~ [^/]\.php(/|$) {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;

        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }

    # 🔥 Optional (biar static file lebih cepat)
    location ~* \.(jpg|jpeg|png|gif|ico|css|js|woff|woff2|ttf|svg)$ {
        expires max;
        log_not_found off;
    }
}

==================================================================
ln -s /etc/nginx/sites-available/situs_a /etc/nginx/sites-enabled/
ln -s /etc/nginx/sites-available/situs_b /etc/nginx/sites-enabled/

======================
nginx -t
systemctl reload nginx

Thursday, 23 April 2026

🚀 Install Moodle 🔥

 🔥 kita langsung gas install stack Moodle (LEMP: Nginx + MariaDB + PHP) yang stabil & ringan untuk server Guru.


🚀 1. Install semua paket sekaligus

apt install nginx mariadb-server php-fpm php-mysql php-xml php-gd php-curl php-zip php-intl php-mbstring php-soap php-bcmath php-cli php-opcache php-ldap php-imagick unzip git -y

🐘 2. Aktifkan service penting

systemctl enable nginx
systemctl enable mariadb
systemctl enable php8.2-fpm

systemctl start nginx
systemctl start mariadb
systemctl start php8.2-fpm

🔐 3. Amankan MariaDB

mysql_secure_installation

👉 Jawaban:

  • Set root password → YES

  • Remove anonymous → YES

  • Disallow root remote → YES

  • Remove test DB → YES


🧠 4. Buat database Moodle

Masuk MariaDB:

mysql -u root -p

Lalu:

CREATE DATABASE moodle DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
CREATE USER 'moodleuser'@'localhost' IDENTIFIED BY 'passwordku';
GRANT ALL PRIVILEGES ON moodle.* TO 'moodleuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;

👉 Ganti:

  • passwordku → password aman versi Guru


⚙️ 5. Setting PHP (WAJIB)

nano /etc/php/8.2/fpm/php.ini

Cari & ubah:

memory_limit = 512M
upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 300

Simpan lalu:

systemctl restart php8.2-fpm

📁 6. Siapkan folder Moodle

mkdir -p /var/www/moodle
mkdir -p /var/moodledata

chown -R www-data:www-data /var/www/moodle
chown -R www-data:www-data /var/moodledata

chmod -R 755 /var/www/moodle
chmod -R 770 /var/moodledata

🌐 7. Config Nginx (siap pakai)

nano /etc/nginx/sites-available/moodle

Isi:

server {
    listen 80;
    server_name _;

    root /var/www/moodle;
    index index.php index.html;

    client_max_body_size 100M;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }

    location ~* \.(jpg|jpeg|png|gif|css|js|ico|svg)$ {
        expires max;
        log_not_found off;
    }
}

Aktifkan:

ln -s /etc/nginx/sites-available/moodle /etc/nginx/sites-enabled/
nginx -t
systemctl reload nginx

📦 8. Download Moodle

cd /var/www/
git clone -b MOODLE_405_STABLE git://git.moodle.org/moodle.git moodle

Set permission lagi:

chown -R www-data:www-data /var/www/moodle

⏰ 9. Setup cron Moodle

crontab -e

Isi:

* * * * * /usr/bin/php /var/www/moodle/admin/cli/cron.php >/dev/null

🌍 10. Akses Moodle

Buka browser:

👉 http://IP_SERVER


🎯 STATUS SEKARANG

Kalau semua benar:

  • Nginx ✅

  • PHP ✅

  • MariaDB ✅

  • Moodle siap install via web ✅


🚀 NEXT STEP

Nanti di browser:

  • pilih bahasa

  • isi database:

    • DB name: moodle

    • user: moodleuser

    • password: (yang dibuat tadi)



Monday, 13 April 2026

buat file site available moodle

 $ cat /etc/nginx/sites-available/moodle
server {
    listen 80;
    listen [::]:80;
    server_name localhost;

    root /var/www/html/moodle;
    index index.php;

    location / {
        try_files $uri $uri/ /index.php?$query_string;
    }

    location ~ \.php(/|$) {
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        include fastcgi_params;

        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        fastcgi_param PATH_INFO $fastcgi_path_info;

        fastcgi_pass unix:/run/php/php8.2-fpm.sock;
    }
}

Oke Guru Duan, config Nginx-nya sudah benar dasar-dasarnya 👍
Sekarang tinggal beberapa langkah penting supaya Moodle benar-benar jalan.


1. Aktifkan site di Nginx

Kalau file ini masih di sites-available, harus di-link ke sites-enabled:

ln -s /etc/nginx/sites-available/moodle /etc/nginx/sites-enabled/

Kalau sudah ada default config, sebaiknya dimatikan:

rm /etc/nginx/sites-enabled/default

2. Test konfigurasi Nginx

Pastikan tidak ada error:

nginx -t

Kalau hasilnya syntax is ok, lanjut.


3. Restart / reload Nginx

systemctl reload nginx

atau

systemctl restart nginx

4. Pastikan PHP-FPM aktif

Karena config pakai:

fastcgi_pass unix:/run/php/php8.2-fpm.sock;

Cek servicenya:

systemctl status php8.2-fpm

Kalau belum jalan:

systemctl start php8.2-fpm
systemctl enable php8.2-fpm

5. Set permission Moodle (penting!)

chown -R www-data:www-data /var/www/html/moodle
chmod -R 755 /var/www/html/moodle

Kalau ada folder moodledata, pastikan juga:

chown -R www-data:www-data /var/www/moodledata
chmod -R 755 /var/www/moodledata

6. Pastikan database sudah siap

Tadi sempat error MySQL ya, jadi cek:

systemctl status mariadb

Kalau belum jalan:

systemctl start mariadb

7. Akses Moodle di browser

Coba buka:

http://IP_SERVER

atau

http://localhost

8. Kalau belum install → lanjut installer Moodle

Kalau masih halaman install, lanjut saja via web:

  • pilih bahasa

  • isi database

  • lanjut sampai selesai


9. (Opsional tapi penting) Ubah server_name

Sekarang masih:

server_name localhost;

Kalau nanti pakai domain (misalnya Cloudflare Tunnel), ganti:

server_name sim.sman2kandangan.sch.id;

10. (Opsional) Tambahan security & performance

Boleh tambahkan ini di dalam server {}:

client_max_body_size 100M;

Ringkasnya langkah berikutnya:

  1. Enable site

  2. Test nginx

  3. Restart nginx

  4. Pastikan PHP-FPM jalan

  5. Pastikan MariaDB jalan

  6. Buka di browser


Kalau setelah ini muncul error (misalnya blank page / 502 / 403), kirim screenshot atau errornya saja — nanti saya bantu telusuri sampai beres 💪



Thursday, 12 March 2026

Service yang WAJIB hidup untuk Moodle

 

Guru Duan, untuk mengakses Moodle di http://localhost, ada 3 service utama yang harus hidup.


Service yang WAJIB hidup untuk Moodle

1️⃣ Web Server

Menampilkan halaman web Moodle.

Service:

nginx.service

Start:

sudo systemctl start nginx

2️⃣ PHP Engine

Menjalankan kode PHP Moodle.

Service:

php8.2-fpm.service

Start:

sudo systemctl start php8.2-fpm

3️⃣ Database

Menyimpan data Moodle.

Service:

mariadb.service

Start:

sudo systemctl start mariadb

Jalankan semua sekaligus

Supaya cepat:

sudo systemctl start nginx php8.2-fpm mariadb

Setelah itu buka browser:

http://localhost/moodle

atau jika di root:

http://localhost

Service yang TIDAK wajib untuk Moodle

Ini tidak mempengaruhi Moodle:

  • pihole-FTL

  • cloudflared

  • docker

  • redis (kecuali dipakai cache)

  • openvpn


Cara cek apakah sudah hidup

systemctl status nginx php8.2-fpm mariadb

Harus muncul:

Active: active (running)

Tips supaya cepat

Guru Duan bisa buat alias:

Tambahkan di ~/.bashrc

alias moodleon="sudo systemctl start nginx php8.2-fpm mariadb"
alias moodleoff="sudo systemctl stop nginx php8.2-fpm mariadb"

Lalu reload:

source ~/.bashrc

Sekarang cukup ketik:

moodleon

Jika Guru Duan mau, saya juga bisa tunjukkan cara mengetahui dalam 3 detik apakah Moodle tidak bisa diakses karena nginx, php, atau database. Ini trik yang sangat membantu saat debugging server.

Tuesday, 3 March 2026

matikan nginx php di laptop

 

Bisa, Guru Duan 👍
TAPI tergantung tujuan laptopnya.

Karena laptop Guru Duan menjalankan:

  • Moodle

  • WordPress

  • Pi-hole

maka:

  • nginx → web server

  • php8.2-fpm → eksekusi PHP

Kalau dua ini dimatikan:

❌ Moodle tidak bisa dibuka
❌ WordPress tidak bisa dibuka
❌ Local web project tidak jalan


🎯 Kapan BOLEH dimatikan nginx & php?

✅ Kalau laptop hanya dipakai browsing / kerja biasa
✅ Tidak sedang testing Moodle
✅ Tidak butuh WordPress lokal
✅ Tidak expose tunnel cloudflared

Kalau itu kondisi Guru Duan → boleh dimatikan.


🧪 Cara Aman (Stop Sementara Dulu)

Coba stop dulu, bukan disable:

sudo systemctl stop nginx
sudo systemctl stop php8.2-fpm

Lalu cek:

systemctl status nginx
systemctl status php8.2-fpm

Kalau mau aktifkan lagi:

sudo systemctl start nginx
sudo systemctl start php8.2-fpm

🚫 Kalau Mau Disable Permanen

sudo systemctl disable nginx
sudo systemctl disable php8.2-fpm

Aktifkan lagi:

sudo systemctl enable nginx
sudo systemctl enable php8.2-fpm

🔥 Rekomendasi Untuk Laptop Guru Duan

Karena Guru Duan sering:

  • Testing Moodle

  • Cek plugin

  • Setup jaringan

  • Uji Pi-hole

Lebih baik jangan disable permanen.

Lebih baik:

  • Stop saja kalau tidak dipakai

  • Atau pakai alias cepat

Contoh buat alias di ~/.bashrc:

alias webon="sudo systemctl start nginx php8.2-fpm"
alias weboff="sudo systemctl stop nginx php8.2-fpm"

Jadi tinggal ketik:

weboff
webon

Lebih praktis 😄


Kalau boleh tahu Guru Duan, tujuan mematikan nginx & php ini untuk hemat RAM atau ada masalah tertentu?

Sunday, 22 June 2025

Cek webserver, php, mariadb version

 

✅ 1. Cek Web Server: Apache atau Nginx

Jalankan:

ps aux | grep -E 'apache2|nginx'

root 1941 0.0 0.0 11156 1532 ? Ss 06:18 0:00 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;
www-data 1942 0.0 0.0 13028 4788 ? S 06:18 0:00 nginx: worker process
www-data 1943 0.0 0.0 13028 4656 ? S 06:18 0:00 nginx: worker process
www-data 1944 0.0 0.0 13028 4444 ? S 06:18 0:00 nginx: worker process
www-data 1945 0.0 0.0 12896 3596 ? S 06:18 0:00 nginx: worker process
dhwan 38805 0.0 0.0 9144 2044 pts/1 S+ 09:55 0:00 grep --color=auto -E apache2|nginx

Contoh output:

  • Jika Anda melihat proses apache2, berarti pakai Apache

  • Jika Anda melihat proses nginx, berarti pakai Nginx

✅ 2. Cek Versi PHP

Jalankan:php -v
$ php -v
PHP 8.2.28 (cli) (built: Mar 13 2025 18:13:49) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c) Zend Technologies
with Zend OPcache v8.2.28, Copyright (c), by Zend Technologies

✅ 3. Cek Versi MySQL atau MariaDB

Cek apakah Anda pakai MySQL atau MariaDB:


Jalankan: mysql -V
$ mysql -V
mysql Ver 15.1 Distrib 10.11.13-MariaDB, for debian-linux-gnu (x86_64) using EditLine wrapper


Tuesday, 14 November 2023

install --classic certbot di nginx debian situs

 # install --classic certbot

install: unrecognized option '--classic'

Try 'install --help' for more information.

root@websma2:~# snap install --classic certbot

certbot 2.7.4 from Certbot Project (certbot-eff✓) installed

root@websma2:~# ln -s /snap/bin/certbot /usr/bin/certbot

root@websma2:~# certbot --nginx

An error occurred while fetching Certbot snap plugins: your version of snapd is outdated.

Please run "sudo snap install core; sudo snap refresh core" in your terminal and try again.

An unexpected error occurred:

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://snapd/v2/connections?snap=certbot&interface=content

Ask for help or search for solutions at https://community.letsencrypt.org. See the logfile /tmp/certbot-log-cu5uqhil/log or re-run Certbot with -v for more details.

root@websma2:~# snap install core

2023-11-14T05:43:09+08:00 INFO Waiting for restart...

core 16-2.60.4 from Canonical✓ installed

Channel latest/stable for core is closed; temporarily forwarding to stable.

root@websma2:~# snap refresh core

snap "core" has no updates available


Install snapd di nginx Debian Situs

 root@websma2:~# apt install snapd

Reading package lists... Done

Building dependency tree       

Reading state information... Done

The following additional packages will be installed:

  liblzo2-2 squashfs-tools

Suggested packages:

  zenity | kdialog

The following NEW packages will be installed:

  liblzo2-2 snapd squashfs-tools

0 upgraded, 3 newly installed, 0 to remove and 6 not upgraded.

Need to get 14.5 MB of archives.

After this operation, 61.5 MB of additional disk space will be used.

Do you want to continue? [Y/n] y

Get:1 http://deb.debian.org/debian buster/main amd64 liblzo2-2 amd64 2.10-0.1 [56.1 kB]

Get:2 http://deb.debian.org/debian buster/main amd64 squashfs-tools amd64 1:4.3-12+deb10u2 [126 kB]

Get:3 http://deb.debian.org/debian buster/main amd64 snapd amd64 2.37.4-1+deb10u1 [14.3 MB]

Fetched 14.5 MB in 2s (6963 kB/s)

apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct!

perl: warning: Setting locale failed.

perl: warning: Please check that your locale settings:

LANGUAGE = "en_US:en",

LC_ALL = (unset),

LC_TIME = "id_ID.UTF-8",

LC_MONETARY = "id_ID.UTF-8",

LC_ADDRESS = "id_ID.UTF-8",

LC_TELEPHONE = "id_ID.UTF-8",

LC_NAME = "id_ID.UTF-8",

LC_MEASUREMENT = "id_ID.UTF-8",

LC_IDENTIFICATION = "id_ID.UTF-8",

LC_NUMERIC = "id_ID.UTF-8",

LC_PAPER = "id_ID.UTF-8",

LANG = "en_US.UTF-8"

    are supported and installed on your system.

perl: warning: Falling back to a fallback locale ("en_US.UTF-8").

locale: Cannot set LC_ALL to default locale: No such file or directory

Selecting previously unselected package liblzo2-2:amd64.

(Reading database ... 41645 files and directories currently installed.)

Preparing to unpack .../liblzo2-2_2.10-0.1_amd64.deb ...

Unpacking liblzo2-2:amd64 (2.10-0.1) ...

Selecting previously unselected package squashfs-tools.

Preparing to unpack .../squashfs-tools_1%3a4.3-12+deb10u2_amd64.deb ...

Unpacking squashfs-tools (1:4.3-12+deb10u2) ...

Selecting previously unselected package snapd.

Preparing to unpack .../snapd_2.37.4-1+deb10u1_amd64.deb ...

Unpacking snapd (2.37.4-1+deb10u1) ...

Setting up liblzo2-2:amd64 (2.10-0.1) ...

Setting up squashfs-tools (1:4.3-12+deb10u2) ...

Setting up snapd (2.37.4-1+deb10u1) ...

Created symlink /etc/systemd/system/multi-user.target.wants/snapd.seeded.service

 → /lib/systemd/system/snapd.seeded.service.

Created symlink /etc/systemd/system/cloud-final.service.wants/snapd.seeded.servi

ce → /lib/systemd/system/snapd.seeded.service.

Created symlink /etc/systemd/system/multi-user.target.wants/snapd.service → /lib

/systemd/system/snapd.service.

Created symlink /etc/systemd/system/sockets.target.wants/snapd.socket → /lib/sys

temd/system/snapd.socket.

Processing triggers for libc-bin (2.28-10+deb10u1) ...

Processing triggers for man-db (2.8.5-2) ...

Processing triggers for mime-support (3.62) ...


https di nginx moodle

 # certbot --nginx

Saving debug log to /var/log/letsencrypt/letsencrypt.log


Which names would you like to activate HTTPS for?

We recommend selecting either all domains, or all domains in a VirtualHost/server block.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

1: daringsmadua.ip-dynamic.com

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Select the appropriate numbers separated by commas and/or spaces, or leave input

blank to select all options shown (Enter 'c' to cancel): 1

Requesting a certificate for daringsmadua.ip-dynamic.com


Successfully received certificate.

Certificate is saved at: /etc/letsencrypt/live/daringsmadua.ip-dynamic.com-0001/fullchain.pem

Key is saved at:         /etc/letsencrypt/live/daringsmadua.ip-dynamic.com-0001/privkey.pem

This certificate expires on 2024-02-11.

These files will be updated when the certificate renews.

Certbot has set up a scheduled task to automatically renew this certificate in the background.


Deploying certificate

Successfully deployed certificate for daringsmadua.ip-dynamic.com to /etc/nginx/sites-enabled/moodle

Congratulations! You have successfully enabled HTTPS on https://daringsmadua.ip-dynamic.com


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

If you like Certbot, please consider supporting our work by:

 * Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donate

 * Donating to EFF:                    https://eff.org/donate-le

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


Wednesday, 28 September 2022

Maximum uploaded file size

 di bagian:

 di https://www.php.net/manual/en/ini.core.php#ini.upload-max-filesize

upload_max_filesize int

The maximum size of an uploaded file.

post_max_size must be larger than this value. 

 

=======================================

 

caranya akses root

nano /etc/nginx/nginx.conf


 

Look for the http section and add the following line (Figure A):

client_max_body_size 100M;

Save and close the file.

Next, open the config file for your website. If you’re using the default, you would open that file with the command:  

nano /etc/nginx/sites-enabled/moodle
 


 

In that file, look for the server section and add the same line as you did in the nginx.conf file (Figure B).


Save and close the file.

Run the NGINX configuration test with the command:

sudo nginx -t

You shouldn’t see any errors. Restart NGINX with the command:

sudo systemctl restart nginx

 

 open the config file php.ini

nano /etc/php/7.4/fpm/php.ini

 memory_limit = 128M
upload_max_filesize = 10M
max_execution_time = 60
post_max_size = 16M

 

Post harus lebih besar daripada upload 


terakhir reboot server

 

 



 

 

 

 

Friday, 10 December 2021

Install Nginx Web Server Debian Wordpress

 Mengingat kita menggunakan LEMP Stack untuk meng-install WordPress di Debian 10, maka kamu perlu meng-install web server Nginx agar nantinya bisa melakukan instalasi WordPress.

root@debian:/usr/src/csf# apt-get install nginx -y
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  libnginx-mod-http-auth-pam libnginx-mod-http-dav-ext
  libnginx-mod-http-echo libnginx-mod-http-geoip
  libnginx-mod-http-image-filter libnginx-mod-http-subs-filter
  libnginx-mod-http-upstream-fair libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream nginx-common nginx-full
Suggested packages:
  fcgiwrap nginx-doc ssl-cert
The following NEW packages will be installed:
  libnginx-mod-http-auth-pam libnginx-mod-http-dav-ext
  libnginx-mod-http-echo libnginx-mod-http-geoip
  libnginx-mod-http-image-filter libnginx-mod-http-subs-filter
  libnginx-mod-http-upstream-fair libnginx-mod-http-xslt-filter
  libnginx-mod-mail libnginx-mod-stream nginx nginx-common nginx-full
0 upgraded, 13 newly installed, 0 to remove and 0 not upgraded.
Need to get 1760 kB of archives.
After this operation, 3295 kB of additional disk space will be used.
Get:1 http://deb.debian.org/debian buster/main amd64 nginx-common all 1.14.2-2+deb10u4 [121 kB]
Get:2 http://deb.debian.org/debian buster/main amd64 libnginx-mod-http-auth-pam amd64 1.14.2-2+deb10u4 [92.8 kB]
Get:3 http://deb.debian.org/debian buster/main amd64 libnginx-mod-http-dav-ext amd64 1.14.2-2+deb10u4 [100 kB]
Get:4 http://deb.debian.org/debian buster/main amd64 libnginx-mod-http-echo amd64 1.14.2-2+deb10u4 [104 kB]
Get:5 http://deb.debian.org/debian buster/main amd64 libnginx-mod-http-geoip amd64 1.14.2-2+deb10u4 [94.1 kB]
Get:6 http://deb.debian.org/debian buster/main amd64 libnginx-mod-http-image-filter amd64 1.14.2-2+deb10u4 [97.6 kB]
Get:7 http://deb.debian.org/debian buster/main amd64 libnginx-mod-http-subs-filter amd64 1.14.2-2+deb10u4 [95.9 kB]
Get:8 http://deb.debian.org/debian buster/main amd64 libnginx-mod-http-upstream-fair amd64 1.14.2-2+deb10u4 [96.0 kB]
Get:9 http://deb.debian.org/debian buster/main amd64 libnginx-mod-http-xslt-filter amd64 1.14.2-2+deb10u4 [95.9 kB]
Get:10 http://deb.debian.org/debian buster/main amd64 libnginx-mod-mail amd64 1.14.2-2+deb10u4 [126 kB]
Get:11 http://deb.debian.org/debian buster/main amd64 libnginx-mod-stream amd64 1.14.2-2+deb10u4 [147 kB]
Get:12 http://deb.debian.org/debian buster/main amd64 nginx-full amd64 1.14.2-2+deb10u4 [501 kB]
Get:13 http://deb.debian.org/debian buster/main amd64 nginx all 1.14.2-2+deb10u4 [88.5 kB]
Fetched 1760 kB in 0s (5039 kB/s)
apt-listchanges: Can't set locale; make sure $LC_* and $LANG are correct!
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US:en",
    LC_ALL = (unset),
    LC_TIME = "id_ID.UTF-8",
    LC_MONETARY = "id_ID.UTF-8",
    LC_ADDRESS = "id_ID.UTF-8",
    LC_TELEPHONE = "id_ID.UTF-8",
    LC_NAME = "id_ID.UTF-8",
    LC_MEASUREMENT = "id_ID.UTF-8",
    LC_IDENTIFICATION = "id_ID.UTF-8",
    LC_NUMERIC = "id_ID.UTF-8",
    LC_PAPER = "id_ID.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
locale: Cannot set LC_ALL to default locale: No such file or directory
Preconfiguring packages ...
Selecting previously unselected package nginx-common.
(Reading database ... 126319 files and directories currently installed.)
Preparing to unpack .../00-nginx-common_1.14.2-2+deb10u4_all.deb ...
Unpacking nginx-common (1.14.2-2+deb10u4) ...
Selecting previously unselected package libnginx-mod-http-auth-pam.
Preparing to unpack .../01-libnginx-mod-http-auth-pam_1.14.2-2+deb10u4_amd64.deb ...
Unpacking libnginx-mod-http-auth-pam (1.14.2-2+deb10u4) ...
Selecting previously unselected package libnginx-mod-http-dav-ext.
Preparing to unpack .../02-libnginx-mod-http-dav-ext_1.14.2-2+deb10u4_amd64.deb ...
Unpacking libnginx-mod-http-dav-ext (1.14.2-2+deb10u4) ...
Selecting previously unselected package libnginx-mod-http-echo.
Preparing to unpack .../03-libnginx-mod-http-echo_1.14.2-2+deb10u4_amd64.deb ...
Unpacking libnginx-mod-http-echo (1.14.2-2+deb10u4) ...
Selecting previously unselected package libnginx-mod-http-geoip.
Preparing to unpack .../04-libnginx-mod-http-geoip_1.14.2-2+deb10u4_amd64.deb ...
Unpacking libnginx-mod-http-geoip (1.14.2-2+deb10u4) ...
Selecting previously unselected package libnginx-mod-http-image-filter.
Preparing to unpack .../05-libnginx-mod-http-image-filter_1.14.2-2+deb10u4_amd64.deb ...
Unpacking libnginx-mod-http-image-filter (1.14.2-2+deb10u4) ...
Selecting previously unselected package libnginx-mod-http-subs-filter.
Preparing to unpack .../06-libnginx-mod-http-subs-filter_1.14.2-2+deb10u4_amd64.deb ...
Unpacking libnginx-mod-http-subs-filter (1.14.2-2+deb10u4) ...
Selecting previously unselected package libnginx-mod-http-upstream-fair.
Preparing to unpack .../07-libnginx-mod-http-upstream-fair_1.14.2-2+deb10u4_amd64.deb ...
Unpacking libnginx-mod-http-upstream-fair (1.14.2-2+deb10u4) ...
Selecting previously unselected package libnginx-mod-http-xslt-filter.
Preparing to unpack .../08-libnginx-mod-http-xslt-filter_1.14.2-2+deb10u4_amd64.deb ...
Unpacking libnginx-mod-http-xslt-filter (1.14.2-2+deb10u4) ...
Selecting previously unselected package libnginx-mod-mail.
Preparing to unpack .../09-libnginx-mod-mail_1.14.2-2+deb10u4_amd64.deb ...
Unpacking libnginx-mod-mail (1.14.2-2+deb10u4) ...
Selecting previously unselected package libnginx-mod-stream.
Preparing to unpack .../10-libnginx-mod-stream_1.14.2-2+deb10u4_amd64.deb ...
Unpacking libnginx-mod-stream (1.14.2-2+deb10u4) ...
Selecting previously unselected package nginx-full.
Preparing to unpack .../11-nginx-full_1.14.2-2+deb10u4_amd64.deb ...
Unpacking nginx-full (1.14.2-2+deb10u4) ...
Selecting previously unselected package nginx.
Preparing to unpack .../12-nginx_1.14.2-2+deb10u4_all.deb ...
Unpacking nginx (1.14.2-2+deb10u4) ...
Setting up nginx-common (1.14.2-2+deb10u4) ...
locale: Cannot set LC_ALL to default locale: No such file or directory
Created symlink /etc/systemd/system/multi-user.target.wants/nginx.service → /lib/systemd/system/nginx.service.
Setting up libnginx-mod-http-xslt-filter (1.14.2-2+deb10u4) ...
Setting up libnginx-mod-http-auth-pam (1.14.2-2+deb10u4) ...
Setting up libnginx-mod-http-geoip (1.14.2-2+deb10u4) ...
Setting up libnginx-mod-http-echo (1.14.2-2+deb10u4) ...
Setting up libnginx-mod-http-subs-filter (1.14.2-2+deb10u4) ...
Setting up libnginx-mod-http-dav-ext (1.14.2-2+deb10u4) ...
Setting up libnginx-mod-mail (1.14.2-2+deb10u4) ...
Setting up libnginx-mod-http-image-filter (1.14.2-2+deb10u4) ...
Setting up libnginx-mod-stream (1.14.2-2+deb10u4) ...
Setting up libnginx-mod-http-upstream-fair (1.14.2-2+deb10u4) ...
Setting up nginx-full (1.14.2-2+deb10u4) ...
Setting up nginx (1.14.2-2+deb10u4) ...
Processing triggers for man-db (2.8.5-2) ...
 

 

Jika instalasinya sudah selesai, start dan aktifkan Nginx on-boot.

root@debian:/usr/src/csf# systemctl enable nginx
Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable nginx
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US:en",
    LC_ALL = (unset),
    LC_TIME = "id_ID.UTF-8",
    LC_MONETARY = "id_ID.UTF-8",
    LC_ADDRESS = "id_ID.UTF-8",
    LC_TELEPHONE = "id_ID.UTF-8",
    LC_NAME = "id_ID.UTF-8",
    LC_MEASUREMENT = "id_ID.UTF-8",
    LC_IDENTIFICATION = "id_ID.UTF-8",
    LC_NUMERIC = "id_ID.UTF-8",
    LC_PAPER = "id_ID.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
perl: warning: Setting locale failed.
perl: warning: Please check that your locale settings:
    LANGUAGE = "en_US:en",
    LC_ALL = (unset),
    LC_TIME = "id_ID.UTF-8",
    LC_MONETARY = "id_ID.UTF-8",
    LC_ADDRESS = "id_ID.UTF-8",
    LC_TELEPHONE = "id_ID.UTF-8",
    LC_NAME = "id_ID.UTF-8",
    LC_MEASUREMENT = "id_ID.UTF-8",
    LC_IDENTIFICATION = "id_ID.UTF-8",
    LC_NUMERIC = "id_ID.UTF-8",
    LC_PAPER = "id_ID.UTF-8",
    LANG = "en_US.UTF-8"
    are supported and installed on your system.
perl: warning: Falling back to a fallback locale ("en_US.UTF-8").
root@debian:/usr/src/csf# systemctl start nginx
 

Cek apakah Nginx sudah running atau belum.


 systemctl status nginx
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor pres
Active: active (running) since Fri 2021-12-10 08:29:24 WITA; 2min 3s ag
Docs: man:nginx(8)
Main PID: 2413 (nginx)
Tasks: 3 (limit: 4529)
Memory: 6.5M
CGroup: /system.slice/nginx.service
├─2413 nginx: master process /usr/sbin/nginx -g daemon on; mast
├─2414 nginx: worker process
└─2415 nginx: worker process

Dec 10 08:29:23 debian systemd[1]: Starting A high performance web server
Dec 10 08:29:24 debian systemd[1]: Started A high performance web server a
lines 1-14/14 (END)...skipping...

 

Gunakan perintah di bawah ini untuk mengecek versi Nginx yang kamu gunakan.

 

  root@debian:/usr/src/csf# nginx -v
nginx version: nginx/1.14.2

 

 

Sunday, 6 September 2020

Setting Nginx agar bisa Upload File di Moodle

Setelah moodle berhasil diakses secara global di internet, dimana saja kapan saja, muncul masalah tidak bisa mengupload tugas pada assignment moodle. Ini karena service nginx secara default membatasi file upload hanya 1MB. Apabila ukuran file lebih dari 1MB, tidak akan bisa diupload.


Agar bisa mengupload file lebih dari 1MB maka perlu dilakukan setting pada service nginx nya:

system administrators should also add client_max_body_size XXXm; to the "http" section of their nginx main configuration file

from: https://www.techrepublic.com/article/how-to-limit-file-upload-size-on-nginx-to-mitigate-dos-attack/

How to configure nginx.conf

The first thing we're going to do is change the upload limit to 100MB in the nginx.conf file. Open the file with the command:

sudo nano /etc/nginx/nginx.conf

Look for the http section and add the following line (Figure A):

client_max_body_size 100M;

Save and close the file.

Figure A

nginxuploada.jpg

Adding the configuration to NGINX config file.

Next, open the config file for your website. If you're using the default, you would open that file with the command:

sudo nano /etc/nginx/sites-available/default

In that file, look for the server section and add the same line as you did in the nginx.conf file (Figure B).

Figure B

nginxuploadb.jpg

Adding the configuration line in the server section of your site config file.

In that same file, locate the location section you've configured for site uploads and add the same line (Figure C).

Figure C

nginxuploadc.jpg

Adding the configuration line in the locations directive.

Of course, your uploads directive will probably be a bit more complex than the basic one I've illustrated, but you get the point.

Save and close the file.

Run the NGINX configuration test with the command:

sudo nginx -t

You shouldn't see any errors. Restart NGINX with the command:

sudo systemctl restart nginx

At this point, if anyone attempts to upload a file size larger than 100 MB, they'll receive a 413 error (Request Entity Too Large). Your NGINX server is now a tiny bit safer from DoS attacks, while still allowing your users to upload files. No, this isn't a be-all-end-all preventive measure for DoS attacks, but these days anything you can do to stave off the ne'er do wells is a step in the right direction.


Saturday, 5 September 2020

Setting Nginx Moodle agar bisa diakses Global

Setelah install moodle di Debian server:

 

Cek isi folder
ls /etc/nginx/site-enabled
Hapus file
rm /etc/nginx/site-enabled/default

 

menghpusnya dengan perintah ini apakah benar:
root@debian:~# rm /etc/nginx/sites-enabled/default
 
File backup nya ada di /etc/nginx/site-available/
 
 
edit config.php nya, itu masih ngarah ke ip lokal
step nya ubah config.php bagian wwwroot menjadi
$CFG->wwwroot = "http://".$_SERVER["HTTP_HOST"];
 
itu config.php di folder moodle nya
 
nano /var/www/html/moodle/config.php
 
$CFG->wwwroot = 'http://192.168.100.10';
$CFG->dataroot = '/var/moodledata';
$CFG->admin = 'admin';
$CFG->directorypermissions = 0777;
 
 
nah itu kan masih pakai ip lokal
ganti dgn ini, agar bisa dinamis
$CFG->wwwroot = "http://".$_SERVER["HTTP_HOST"];
 
 
di config.php pakai satu koma atas mas, di sampean dua koma atas, apa jadikan satu koma atau bagaimana  
 
 
 $CFG->wwwroot = 'http://'.$_SERVER['HTTP_HOST'];