Daftar Isi
- Migrasi MPM Prefork ke MPM Event
- Pengaturan MPM Event
- |-Apache
- |-PHP (1 Pool Untuk 1 Virtual Host)
- |-PHP (Banyak Pool Untuk Banyak Virtual Host)
- |-Uji Isolasi
- |-Penyelesaian Permasalahan
- SFTP Only
- Mengaktifkan HTTP2
- Mengaktifkan opcache
- Pengujian
- Perlindungan Aplikasi
- Cheat Untuk Server Sendiri
- Windows mod_fcgid (XAMPP)
Windows mod_fcgid (XAMPP)
- Unduh mod_fcgid di laman https://www.apachelounge.com/download/
- Pastikan Apache dalam keadaan berhenti
- Buka cmd (command prompt)
- Apabila xampp diinstal selain di C:\xampp, misalnya di C:\Program Files\xampp, maka jalankan
mklink /j C:\xampp "C:\Program Files\xampp"
di cmd. - Jalankan
explorer C:\xampp\apache\modules
di cmd. Ekstrakmod_fcgid.so
ke dalam folder tersebut. - Jalankan
notepad C:\xampp\apache\conf\extra\httpd-fcgid.conf
di cmd. Pengaturan di bawah ini adalah pengaturan untuk sisa RAM 1 Gb, gantiFcgidMaxProcesses
dengan rumus7% * sisaRAMdalamGb * 150
atau21 * (sisaRAMdalamGb / 2)
atau10,5 * sisaRAMdalamGb
. Pembulatan ke bawah. Salin pengaturan di bawah ini:
#
# XAMPP settings
#
<IfModule env_module>
SetEnv MIBDIRS "C:/xampp/php/extras/mibs"
SetEnv MYSQL_HOME "\\xampp\\mysql\\bin"
SetEnv OPENSSL_CONF "C:/xampp/apache/bin/openssl.cnf"
SetEnv PHP_PEAR_SYSCONF_DIR "\\xampp\\php"
SetEnv PHPRC "\\xampp\\php"
SetEnv TMP "\\xampp\\tmp"
</IfModule>
#
# PHP-Module setup
#
# LoadFile "C:/xampp/php/php7ts.dll"
# LoadFile "C:/xampp/php/libpq.dll"
# LoadModule php7_module "C:/xampp/php/php7apache2_4.dll"
# <FilesMatch "\.php$">
# SetHandler application/x-httpd-php
# </FilesMatch>
# <FilesMatch "\.phps$">
# SetHandler application/x-httpd-php-source
# </FilesMatch>
#
# PHP-FastCGI setup
#
LoadModule fcgid_module modules/mod_fcgid.so
<IfModule fcgid_module>
FcgidInitialEnv PATH "C:/xampp/php"
FcgidInitialEnv SystemRoot "C:/Windows"
FcgidInitialEnv SystemDrive "C:"
FcgidInitialEnv TEMP "C:/xampp/tmp"
FcgidInitialEnv TMP "C:/xampp/tmp"
FcgidInitialEnv windir "C:/windows"
#set FcgidIPCDir to avoid conflict with another server
FcgidIPCDir "C:/xampp/pipe"
FcgidIdleTimeout 1800
FcgidProcessLifeTime 1800
FcgidBusyTimeout 1800
FcgidIOTimeout 1800
FcgidConnectTimeout 20
FcgidMaxRequestsPerProcess 1000
FcgidMaxProcesses 10
#FcgidMaxRequestLen (bytes) equal to upload_max_filesize (Mbytes) on php.ini; 1000000 byte=1 Mbyte
FcgidMaxRequestLen 2000000
# Location php.ini:
FcgidInitialEnv PHPRC "C:/xampp/php"
FcgidInitialEnv PHP_FCGI_MAX_REQUESTS 1000
<Files ~ "\.php$">
Options Indexes FollowSymLinks ExecCGI
AddHandler fcgid-script .php
FcgidWrapper "C:/xampp/php/php-cgi.exe" .php
</Files>
</IfModule>
<IfModule mime_module>
AddType application/x-httpd-php .php
AddType application/x-httpd-php .php3
</IfModule>
#
# PHP-CGI setup
#
#<FilesMatch "\.php$">
# SetHandler application/x-httpd-php-cgi
#</FilesMatch>
#<IfModule actions_module>
# Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
#</IfModule>
# <IfModule php7_module>
# PHPINIDir "C:/xampp/php"
# </IfModule>
<IfModule mime_module>
AddType text/html .php .phps
</IfModule>
ScriptAlias /php-cgi/ "C:/xampp/php/"
<Directory "C:/xampp/php">
AllowOverride None
Options None
Require all denied
<Files "php-cgi.exe">
Require all granted
</Files>
</Directory>
<Directory "C:/xampp/cgi-bin">
<FilesMatch "\.php$">
SetHandler cgi-script
</FilesMatch>
<FilesMatch "\.phps$">
SetHandler None
</FilesMatch>
</Directory>
<Directory "C:/xampp/htdocs/xampp">
<IfModule php7_module>
<Files "status.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
</Directory>
<IfModule alias_module>
Alias /licenses "C:/xampp/licenses/"
<Directory "C:/xampp/licenses">
Options +Indexes
<IfModule autoindex_color_module>
DirectoryIndexTextColor "#000000"
DirectoryIndexBGColor "#f8e8a0"
DirectoryIndexLinkColor "#bb3902"
DirectoryIndexVLinkColor "#bb3902"
DirectoryIndexALinkColor "#bb3902"
</IfModule>
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
Alias /phpmyadmin "C:/xampp/phpMyAdmin/"
<Directory "C:/xampp/phpMyAdmin">
AllowOverride AuthConfig
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
Alias /webalizer "C:/xampp/webalizer/"
<Directory "C:/xampp/webalizer">
<IfModule php7_module>
<Files "webalizer.php">
php_admin_flag safe_mode off
</Files>
</IfModule>
AllowOverride AuthConfig
Require local
ErrorDocument 403 /error/XAMPP_FORBIDDEN.html.var
</Directory>
</IfModule>
catatan:
Path pada FcgidWrapper jika terdapat spasi sebaiknya di escape, misalnya C:/Program Files/
menjadi C:/Program\ Files/
- Jalankan
notepad C:\xampp\apache\conf\httpd.conf
di cmd. Tambahkan pengaturan di berikut iniLoadModule fcgid_module modules/mod_fcgid.so
#FCGID Module
Include "conf/extra/httpd-fcgid.conf" - Jalankan
notepad C:\xampp\apache\conf\extra\httpd-xampp.conf
di cmd. Buka/tambahkan pengaturan di bawah ini:
#
# PHP-CGI setup
#
<FilesMatch "\.php$">
SetHandler application/x-httpd-php-cgi
</FilesMatch>
<IfModule actions_module>
Action application/x-httpd-php-cgi "/php-cgi/php-cgi.exe"
</IfModule>
Demikian, semoga bermanfaat. [bst]
Sumber:
- https://httpd.apache.org/docs/2.4/mpm.html
- https://www.php.net/manual/en/install.windows.apache2.php
- https://gist.github.com/GAS85/990b46a3a9c2a16c0ece4e48ebce7300
- https://medium.com/@sbuckpesch/apache2-and-php-fpm-performance-optimization-step-by-step-guide-1bfecf161534
- https://stackoverflow.com/questions/3058137/finding-process-count-in-linux-via-command-line
- https://www.sneppets.com/php/php-fastcgi-on-windows-in-xampp-for-php-performance/
- https://gist.github.com/basilfx/51cea37d10f4f4d68c74681d01f72e07
- https://www.apachelounge.com/viewtopic.php?p=25699
- https://nixcp.com/script-timed-out-before-returning-headers-index-php/
- https://helpful.knobs-dials.com/index.php/SSH_-_SSH_jails
6 replies on “Move On MPM Prefork ke MPM Event, Sebuah Catatan”
[…] Materi ini terkait dengan: https://pdsi.unisayogya.ac.id/move-on-mpm-prefork-ke-mpm-event-sebuah-catatan/ […]
[…] Inspirasi: https://pdsi.unisayogya.ac.id/move-on-mpm-prefork-ke-mpm-event-sebuah-catatan/3/#windows-mod-fcgid […]
[…] Inspirasi: https://pdsi.unisayogya.ac.id/mengaktifkan-ssl-https-pada-web-berbasis-apache-dan-open-ssl/2/#feederpddiktihttps://pdsi.unisayogya.ac.id/move-on-mpm-prefork-ke-mpm-event-sebuah-catatan/ […]
[…] https://pdsi.unisayogya.ac.id/move-on-mpm-prefork-ke-mpm-event-sebuah-catatan/ […]
[…] Cara mengaktifkan HTTP2 (HTTPS) pada Apache2: https://pdsi.unisayogya.ac.id/move-on-mpm-prefork-ke-mpm-event-sebuah-catatan/#mengaktifkan-http2 […]
[…] Move On MPM Prefork ke MPM Event, Sebuah Catatan […]