Tampilkan postingan dengan label ubuntu. Tampilkan semua postingan
Tampilkan postingan dengan label ubuntu. Tampilkan semua postingan

Sabtu, 12 Februari 2022

Solusi mengubah mpm ke mpm_worker

 I found the possible solution to resolve this on my ubuntu server, dont know whether you are running ubuntu as well on your side, but I feel that the steps that I have taken will be the same for almost all distros with change in 1 step where you need to install a new package and the command for that may change based on the distro that you are using.

so the first step is

$ sudo a2dismod php7.3 mpm_prefork

This will disable the prefork module but before that it will disable the php7.3 module to stop the dependency error from occurring.

Next, we enable the worker module

$ sudo a2enmod mpm_worker

Now, the output would suggest that you restart the apache web-server. So, we do the same

$ sudo systemctl restart apache2

Now, if you go to check your website homepage, it may either throw an error or may load a blank page.

So, how do we resolve that; I scoured multiple community forums and found a solution related to the same but it was for freebsd platform so tried the same on ubuntu with some tweaks required to be made on ubuntu side for the steps to work.

The Solution based on ubuntu OS :

First of all, we enable the proxy, proxy_fcgi and setenvif module followed with a php-fpm package installation corresponding to your php version

$ sudo a2enmod proxy
$ sudo a2enmod proxy_fcgi
$ sudo a2enmod setenvif
$ sudo apt-get install php7.3-fpm -y

the php7.3-fpm installation command is the one where you may need to check the installation steps based on the Distro you are using.

Once, php-fpm service is installed you need to make sure that it gets enabled and then start it, so for that

$ sudo a2enconf php7.3-fpm
$ sudo systemctl enable php7.3-fpm.service
$ sudo systemctl start php7.3-fpm.service

Once, the php-fpm service starts successfully, just restart apache service to make sure all the made changes take effect properly

$ sudo systemctl restart apache2

After these steps are taken, please check/refresh your website homepage and the error page or the blank page will change to the proper website page.

The End-Result; your website has shifted from using prefork module to worker module to handle requests.

Also, if you want to switch to event module instead of worker module; just enable event module in place of worker module in the second step; the one that you will take after disabling php7.3 and prefork module

replace

$ sudo a2enmod mpm_worker

with

$ sudo a2enmod mpm_event

rest all steps after that remain the same irrespective of enabling worker or event module.

These steps helped me switch from prefork module to worker module on my server so hoping it may help you as well as help others who stumble on this issue.

Share:

Kamis, 27 Januari 2022

Mengenal Kinerja Apache Worker di Balik Layanan Data Berbasis Web

 Blog.Gamatechno.com – Memiliki sebuah layanan berbasis web menuntut pemiliknya untuk terus meningkatkan layanannya. Apalagi saat web harus diakses oleh banyak orang, tentu saja performa dan kinerjanya harus dapat dipastikan tangguh agar benar-benar kuat dan siap melayani request dari pengguna. Dengan produk-produk yang sebagian besar berbasis web, Gamatechno pun selalu melakukan improvment teknologi pada layanannya. Salah satunya adalah perubahan mode kerja di web server Gamatechno, terutama untuk produk segment Academic yang memiliki banyak client perguruan tinggi.

Apa itu Web server, mode kerja dan perubahan apa yang perlu dilakukan untuk meningkatkan kinerja layanan data web akan diulas lengkap oleh Wahyu Bimo Sukarno dalam artikel berikut.

Web server pada layanan data berbasis web

Web server secara fisik didefinisikan sebagai sebuah komputer/host yang berfungsi untuk menyimpan dan memberikan layanan data HTTP. Saat website di akses oleh banyak orang dalam satu waktu bersamaan, web server akan bekerja sangat keras. Pada waktu inilah kita bisa mengukur seperti apa kinerja web server yang kita gunakan.

Istilah untuk jumlah permintaan data dalam waktu bersamaan disebut concurent connection. Apabila concurent connection tidak dibatasi, maka space memory dan processor server akan habis. Jika hal itu berlangsung terus menerus dalam waktu yang lama maka server bisa berhenti melayani permintaan akses website bahkan sampai terjadi kerusakan hardware. Tentu tidak jarang kita mendengar istilah komputer server yang mati bukan? Hal itulah yang menjadi salah satu penyebabnya.

Mode Kerja Prefork vs Worker

Web server masa kini memiliki banyak pilihan mode kerja (working mode), di antaranya Prefork atau Multi Processing Module Prefork (MPM Prefork) dan Worker (MPM Worker). Bagi pengguna server Apache, mode prefork merupakan mode yang otomatis digunakan/default saat instalasi. Namun mode kerja ini memiliki kemampuan concurrency/proses transaksi yang rendah sehingga hanya cocok untuk aplikasi skala kecil.

Ketika web server harus diakses oleh user dalam jumlah banyak, mode Worker menjadi pilihan yang pas. Dengan concurrency yang tinggi serta kemampuannya yang efektif dan efisien mengatur proses kerja, web server akan jauh lebih tangguh dengan mode ini.  

Gambar berikut ini dapat menjelaskan proses di mode Prefork yang hanya bisa menangani satu user saja, sementara di mode Worker, satu proses bisa terdiri dari banyak thread dan banyak user. Daemon adalah proses yang berjalan secara realtime dan berfungsi membuat aplikasi yang berjalan di service berjalan secara otomatis.

image 1
Gambar 1. Perbandingan cara kerja mode Prefork dan mode Worker

Perhatikan konfigurasi prefork mode pada gambar di bawah ini!

image 2
Gambar 2. Konfigurasi Mode Prefork

Konfigurasi tersebut memiliki arti bahwa jika mode Prefork yang diaktifkan maka akan disediakan setidaknya 5 daemon server. Dalam suatu proses dapat disediakan lebih dari 10 daemon server, dengan setiap daemonnya memiliki kemampuan menangani 150 request. Berarti dalam satu waktu bersamaan, Apache mampu melakukan handling 1500 request. Apakah yang akan terjadi jika request yang ada melebihi jumlah yang disediakan? Maka koneksi selanjutnya, misal ke 1501? Koneksi selanjutnya akan difilter oleh firewall Apache, dan memasuki masa tunggu. Dalam browser si client, akan terjadi halaman kosong dengan status-bar waiting yang cukup lama, menunggu salah satu proses dari 1500 tersebut berhenti.

Bagaimana dengan Apache Worker? Perhatikan pada konfigurasi di bawah ini :

image 3
Gambar 3. Konfigurasi Mode Worker

Dalam konfigurasi tersebut, tersedia daemon server sejumlah lima server. Sedangkan tiap server akan tersedia minimal daemon thread sebanyak 25, dan dapat hingga 75 jika dibutuhkan. Thread Limit akan menentukan jumlah maksimal Thread process yang akan dikerjakan. Tiap thread akan bertanggung jawab kepada sejumlah MaxClients.

Improve teknologi untuk terus tingkatkan layanan

Ketika layanan web server semakin banyak diakses oleh pengguna, perubahan dari mode default prefork menjadi worker menjadi sebuah kebutuhan. Seperti yang dilakukan Gamatechno di sisi layanan servernya. Mode worker saat ini sudah digunakan Gamatechno sebagai bentuk peningkatan layanan kepada ratusan perguruan tinggi yang menjadi client Gamatechno. Perubahan mode ini membuat Gamatechno menjadi lebih siap support concurent connection yang sangat mungkin terjadi dari kampus-kampus yang menggunakan produk Gamatechno. Info lebih lanjut tentang produk dan dukungan layanan Gamatechno, bisa di cek di www.gamatechno.com

Sumber image: www.technologydatagroup.com

Share:

Selasa, 23 Februari 2021

Tutorial Memperbaiki Access denied for user ‘root’@’localhost’ Mysql

 

Tutorial Memperbaiki Access denied for user ‘root’@’localhost’ Mysql

 

 

 

Kalian telah menginstal phpMyAdmin tetapi tidak dapat login menggunakan akun root. Biasanya error tersebut ditandai dengan notifikasi seperti berikut:

mysqli_real_connect(): (HY000/1698): Access denied for user 'root'@'localhost'

Nah, disini saya akan share bagaimana cara mengatasi phpmyadmin error - 
Access denied for user ‘root’@’localhost’ - di komputer yang menggunakan linux ubuntu.

Perlu diketahui sebelumnya, error tersebut terjadi karena MySQL tidak mengizinkan remote user untuk login sebagai root disebabkan alasan keamanan. Sebaiknya jangan biarkan akun root dapat diakses dari jarak jauh (remote access) melalui phpMyAdmin karena bot dan peretas umumnya selalu menscan akun ini secara terus-menerus.

Sebagai gantinya, buat akun pengguna baru dengan nama pengguna yang berbeda.

Di terminal, login ke MySQL sebagai root. Kalian mestinya telah membuat kata sandi root ketika menginstal MySQL untuk pertama kalinya atau kata sandi bisa kosong karena kalian menekan ENTER ketika diminta untuk memasukkan kata sandi.


$ sudo mysql -p -u root


Sekarang tambahkan pengguna MySQL baru dengan nama user terserah kalian. Dalam contoh ini saya membuat nama user "pmauser" (untuk pengguna phpmyadmin). Pastikan untuk mengganti kata password_anda dengan milik kalian sendiri. Simbol % di sini memberitahu MySQL untuk memungkinkan pengguna ini bisa masuk dari mana saja dari jarak jauh. Jika menginginkan keamanan yang tinggi, kalian dapat mengganti simbol tadi dengan alamat IP.


CREATE USER 'pmauser'@'%' IDENTIFIED BY 'password_anda';


Sekarang lanjut dengan memberikan hak superuser kepada pengguna baru tersebut.


GRANT ALL PRIVILEGES ON *.* TO 'pmauser'@'%' WITH GRANT OPTION;


Nah, sekarang harusnya kalian bisa mengakses phpMyAdmin menggunakan akun pengguna baru ini.

Semoga membantu!

 

Share:

Minggu, 29 November 2020

Tuning Apache2

 


How to enable Apache MPM Prefork to improve performance

The Apache web server is one of the most popular on the planet. Out of the box, Apache does a pretty solid job of handling average traffic. But, once you start hitting it with an above average load, under certain circumstances such as resource capacity and complexity of websites served, you might find it struggles a bit. If that describes what you are experiencing, the Multi-Processing Modules (MPM) Prefork module might be in order.

The MPM Prefork module uses a single control process which is responsible for launching child processes. These child processes listen for connections and serve them when they arrive. MPM Prefork is self-regulating, so unless you need a much larger overhead, there's very little cause for adjusting it's default configurations. However, you do need to enable this module as it is disabled out of the box.

I'm going to show you how to enable the MPM Prefork module on Apache. I'll be demonstrating on Ubuntu Server 18.04. 

What you'll need

The only things you'll need to enable this module are:

  • A running instance of Ubuntu Server 18.04
  • Apache installed and running
  • A user with sudo privileges
  • A network connection

How to enable the mpm_prefork

Most likely, the mpm_prefork module is already installed on your Apache instance. Out of the box, however, it's not enabled. 

Apache2 has support for both prefork and worker. These are both MPMs, but are quite different from one another. The prefork module creates a number of child processes at launch, each child process handles only one thread. Conversely, worker uses child processes which spawn many threads per process, with each thread ready to take on new requests. Although prefork requires considerably more RAM, it is the safest module and should be employed when using non-thread-safe libraries.

To check to see if the prefork module is loaded, issue the command:

apache2ctl -M | grep prefork

If you see no results, prefork isn't loaded. Before you do load it, you'll have to first unload the mpm_event module, as they will conflict. To unload mpm_event, issue the command:

sudo a2dismod mpm_event

Restart Apache with the command:

sudo systemctl restart apache2

Now you can load mpm_prefork with the command:

sudo a2enmod mpm_prefork

Once again, restart Apache with the command:

sudo systemctl restart apache2

How to configure the mpm_prefork

On the off-chance your web server does need significant overhead, you can make adjustments to the prefork configuration. To do this, issue the command:

sudo nano /etc/apache2/mods-available/mpm_prefork.conf

In that file, you'll see the following options:

StartServers                       5
MinSpareServers               5
MaxSpareServers              10
MaxRequestWorkers         150
MaxConnectionsPerChild   0

You might want to bump those numbers up considerably, if you know your server is going to be under a larger load (and you have the RAM to spare), you could alter that configuration like so:

StartServers                          4
MinSpareServers                  3
MaxSpareServers                 40
MaxRequestWorkers             200
MaxConnectionsPerChild      10000

Make sure to edit those numbers according to what your hardware can handle and your expected load will require. Save and close the file. Restart Apache with the command:

sudo systemctl restart apache2

At this point, mpm_prefork is enabled and configured. If you're interested in testing this out, you can run a Perl script. Please use caution when doing so, as it is a Perl script and you just never know. In fact, you might want to download the script and comb through it first (to check for any nefarious code).

Download the script with this command:

wget  https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl

Once you've looked through it, and found it trustworthy, run the command:

sudo perl apache2buddy.pl

Once the command completes, you should see a report of Apache's memory usage (Figure A).

Figure A

prefork-a.jpg

Post mpm_prefork configuration memory usage.

And there you have it. Apache mpm_prefork is now doing its thing. Make sure to adjust your configuration to best meet the needs of your environment and this module will serve you well.

Also see

Share:

Rabu, 18 November 2020

Mengatasi Eror Not Found phpMyAdmin Di Linux

 

Latar Belakang
Setelah menginstall phpMyAdmin saya mengalami masalah yaitu ketika saya masuk ke phpMyAdmin dengan mengetikkan localhost/phpmyadmin pada web browser saya, Tetapi kenyataan berkata lain malah saya mendapatkan eror yaitu Not Found / Tidak Ditemukan akhirnya saya mondar mandir sana sini mencari solusi dan akhirnya ketemu juga. Mungkin sobat juga mengalami masalah seperti ini

Maksud dan Tujuan
Agar kita dapat mengetahui cara memperbaiki eror pada phpMyAdmin khususnya eror 404 Not Found dan dapat menggunakan phpMyAdmin

Alat dan Bahan

  • PC / Laptop
  • Terminal

Tahapan Pelaksanaan
1. Pertama kita harus membuka terminal ( CTRL + ALT + T )
2. Tuliskan perintah berikut pada terminal

sudo ln -s /usr/share/phpmyadmin /var/www/html

Jika masih error ikuti langkah ini

1. Masuk ke apache.conf dengan cara mengetikkan perintah berikut pada terminal

sudo gedit /etc/apache2/apache2.conf

2. Kemudian tambahkan baris pada text editor tadi dan ketikkan

Include /etc/phpmyadmin/apache.conf

3. Sekarang kita restart apache2 dengan perintah

sudo service apache2 restart


Kesimpulan
Dapat kita simpulkan mengapa phpMyAdmin tidak ditemukan ? Karena file phpmyadmin belum berada di /var/www/html atau yang disebut dengan localhost dalam web browser. Pantas saja saat kita mengetikkan localhost/phpmyadmin tidak muncul, orang di file tersebut gak ada file phpmyadmim? ya pantas saja tidak ditemukan :v.

Referensi

  • Ask Ubuntu
Share:

[TUTORIAL UBUNTU] MENGATASI PESAN “SUDO: UNABLE TO RESOLVE HOST” DI TERMINAL UBUNTU 16.04 LTS

 Kemarin saya menemukan pesan di terminal seperti pada judul di atas pada saat menjalankan perintah sudo. Pesan tersebut muncul setelah saya install Ubuntu 16.04 LTS. Padahal Ubuntu versi-versi sebelumnya saya tidak pernah menemukan pesan tersebut. Memang pesan tersebut tidak ada efeknya pada saat saya menjalankan perintah sudo, namun saya tetap bertanya-tanya kenapa pesan tersebut muncul. Akhirnya saya menemukan jawabannya setelah saya bertanya di forum Ubuntu Indonesia. Pesan tersebut muncul karena terjadi perbedaan nama host antara file /etc/hostname dengan file /etc/hosts. Berikut cara mengatasinya :

  • Buka terminal. Ketik cat /etc/hostname. Akan muncul nama host di system Ubuntu.

  • Masih di terminal, ketik cat /etc/hosts. Akan muncul nama host di system Ubuntu.

    screenshot-from-2016-10-31-06-16-03

  • Apabila terjadi perbedaan antara /etc/hostname dengan /etc/hosts lakukan perubahan dengan cara ketik sudo gedit /etc/hosts. Rubah dan sesuaikan nama hostnya.

    Screenshot from 2016-10-31 06-23-26.png

  • Setelah itu save dan restart system Ubuntu.

Share:

KEPALA SMAN 95


Kepala SMAN 95 Jakarta

Dewi Elvi, S.Pd, M.Si

Profil SMAN 95

Pelepasan 2020