• Masim “Vavai” Sugianto

    Founder PT. Excellent Infotama Kreasindo– perusahaan email services provider (ESP) dan menjadi konsultan pada berbagai instansi pemerintah, korporasi besar, lembaga perbankan dan institusi pendidikan di Indonesia.

    Lebih detail tentang Vavai.




  • Publishing

  • Recent Posts

    • Pengalaman Saat Sakit : Keluarga, Sahabat dan Bagaimana Jika…
    • Refleksi Setelah Sakit
    • Legacy
    • Bitcoin, Ethereum, Dogecoin
    • Penjualan Langsung : Keliling dan Mangkal
  • Recent Comments

    • PT. Infra Solution International on Perkembangan Usaha Penjualan Pisang “Zeze Zahra” Setelah 1 Bulan
    • PT. Infra Solution International on Refleksi Setelah Sakit
    • PT. Infra Solution International on Pengalaman Saat Sakit : Keluarga, Sahabat dan Bagaimana Jika…
    • ict Administrator on Pengalaman Saat Sakit : Keluarga, Sahabat dan Bagaimana Jika…
    • sada dua on Pengalaman Saat Sakit : Keluarga, Sahabat dan Bagaimana Jika…
  • Archives

    • February 2021
    • January 2021
    • December 2020
    • August 2020
    • July 2020
    • April 2020
    • March 2020
    • August 2019
    • July 2019
    • June 2019
    • March 2019
    • February 2019
    • January 2019
    • November 2018
    • October 2018
    • August 2018
    • May 2018
    • April 2018
    • January 2018
    • December 2017
    • July 2017
    • December 2016
    • November 2016
    • April 2016
    • March 2016
    • November 2015
    • July 2015
    • April 2015
    • November 2014
    • October 2014
    • February 2014
    • January 2014
    • December 2013
    • November 2013
    • October 2013
    • September 2013
    • August 2013
    • June 2013
    • May 2013
    • March 2013
    • February 2013
    • January 2013
    • December 2012
    • November 2012
    • October 2012
    • September 2012
    • August 2012
    • July 2012
    • June 2012
    • May 2012
    • April 2012
    • March 2012
    • February 2012
    • January 2012
    • December 2011
    • November 2011
    • October 2011
    • September 2011
    • August 2011
    • July 2011
    • June 2011
    • May 2011
    • April 2011
    • March 2011
    • February 2011
    • January 2011
    • December 2010
    • November 2010
    • October 2010
    • September 2010
    • August 2010
    • July 2010
    • June 2010
    • May 2010
    • April 2010
    • March 2010
    • February 2010
    • January 2010
    • October 2008
    • September 2008
    • August 2008
    • July 2008
    • June 2008
    • May 2008
    • April 2008
    • March 2008
    • February 2008
    • January 2008
    • December 2007
    • November 2007
    • October 2007
    • September 2007
    • August 2007
    • July 2007
    • June 2007
    • May 2007
    • April 2007
    • March 2007
  • Home
  • Bisnis & Marketing
  • Computer & IT Related
  • Lifestyle
  • Publishing
  • Free Stuff
  • About
  • Kontak

Instalasi Lighttpd, PHP5 dan MySQL pada openSUSE 11.4

April 17, 2011

Lighttpd adalah aplikasi web server yang di desain untuk kebutuhan akses yang cepat dan aman. Dalam tutorial ini diberikan bagaimana menginstal Lighttpd pada openSUSE 11.4 dengan PHP5 dan MySQL.

1. Menginstal MySQL 5

Pertama kita menginstal MySQL 5 sebagai berikut

yast2 -i mysql mysql-client mysql-community-server

yast2 -i mysql mysql-client mysql-community-server

kemudian buat links system startup untuk MySQL , agar MySQL secara otomatis start pada saat booting sistem

chkconfig -f --add mysql
/etc/init.d/mysql start

chkconfig -f --add mysql /etc/init.d/mysql start

Untuk menjalankan instalasi MySQL secara aman, jalankan perintah

mysql_secure_installation

mysql_secure_installation

sekarang kita akan ditanyai beberapa pertanyaan :

server1:~#mysql_secure_installation
 
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
 
In order to log into MySQL to secure it, we'll need the current
password for the root user.  If you've just installed MySQL, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
 
Enter current password for root (enter for none): <-- ENTER
OK, successfully used password, moving on...
 
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
 
Set root password? [Y/n] <-- Y
New password: <-- fill in your desired MySQL root password
Re-enter new password: <-- confirm that password
Password updated successfully!
Reloading privilege tables..
 ... Success!
 
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.
 
Remove anonymous users? [Y/n] <-- Y
 ... Success!
 
Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.
 
Disallow root login remotely? [Y/n] <-- Y
 ... Success!
 
By default, MySQL comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.
 
Remove test database and access to it? [Y/n] <-- Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!
 
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
 
Reload privilege tables now? [Y/n] <-- Y
 ... Success!
 
Cleaning up...
 
All done!  If you've completed all of the above steps, your MySQL
installation should now be secure.
 
Thanks for using MySQL!
 
server1:~ #

server1:~#mysql_secure_installation NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL       SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY! In order to log into MySQL to secure it, we'll need the current password for the root user.  If you've just installed MySQL, and you haven't set the root password yet, the password will be blank, so you should just press enter here. Enter current password for root (enter for none): <-- ENTER OK, successfully used password, moving on... Setting the root password ensures that nobody can log into the MySQL root user without the proper authorisation. Set root password? [Y/n] <-- Y New password: <-- fill in your desired MySQL root password Re-enter new password: <-- confirm that password Password updated successfully! Reloading privilege tables..  ... Success! By default, a MySQL installation has an anonymous user, allowing anyone to log into MySQL without having to have a user account created for them.  This is intended only for testing, and to make the installation go a bit smoother.  You should remove them before moving into a production environment. Remove anonymous users? [Y/n] <-- Y  ... Success! Normally, root should only be allowed to connect from 'localhost'.  This ensures that someone cannot guess at the root password from the network. Disallow root login remotely? [Y/n] <-- Y  ... Success! By default, MySQL comes with a database named 'test' that anyone can access.  This is also intended only for testing, and should be removed before moving into a production environment. Remove test database and access to it? [Y/n] <-- Y  - Dropping test database...  ... Success!  - Removing privileges on test database...  ... Success! Reloading the privilege tables will ensure that all changes made so far will take effect immediately. Reload privilege tables now? [Y/n] <-- Y  ... Success! Cleaning up... All done!  If you've completed all of the above steps, your MySQL installation should now be secure. Thanks for using MySQL! server1:~ #

2. Menginstall Lighttpd

Paket Lighttpd tersedia dalam paket openSUSE, sehingga dapat diinstall dengan mudah menggunakan perintah :

yast2 -i lighttpd

yast2 -i lighttpd

kemudian buat startup link untuk lighttpd seperti pada saat kita membuatnya pada mysql

chkconfig -f --add lighttpd
/etc/init.d/lighttpd start

chkconfig -f --add lighttpd /etc/init.d/lighttpd start

Sekarang kita bisa server kita secara langsung melalui web browser dengan alamat http://192.168.0.100 dan seharusnya terlihat lighttpd menampilkan sebuah halaman. Jika yang terlihat error 404 maka itu berarti sudah berjalan dengan semestinya karena belum ada file index untuk dokumen root lighttpd.

Secara defaults, dokumen root lighttpd pada openSUSE terletak pada direktori /srv/www/htdocs dan file konfigurasinya terletak pada /etc/lighttpd/lighttpd.conf

3. Menginstal PHP5
Kita bisa membuat PHP5 bekerja dalam Lighttpd melalui FastCGI. Jadi kita dapat menginstalnya dengan menggunakan perintah

yast2 -i php5-fastcgi

yast2 -i php5-fastcgi

4. Mengkonfigurasi Lighttpd dan PHP5
untuk meng-enable PHP5 dalam Lighttpd kita harus mengubah tiga file, yaitu /etc/php5/fastcgi/php.ini, /etc/lighttpd/modules.conf dan /etc/lighttpd/conf.d/fastcgi.conf. Pertama buka file /etc/php5/fastcgi/php.ini dan uncomment baris cgi.fic_pathingo=1 yang berada di tengah dari file tersebut

vi /etc/php5/fastcgi/php.ini

vi /etc/php5/fastcgi/php.ini

jadikan seperti ini

[...]
; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI.  PHP's
; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok
; what PATH_INFO is.  For more information on PATH_INFO, see the cgi specs.  Setting
; this to 1 will cause PHP CGI to fix its paths to conform to the spec.  A setting
; of zero causes PHP to behave as before.  Default is 1.  You should fix your scripts
; to use SCRIPT_FILENAME rather than PATH_TRANSLATED.
; http://php.net/cgi.fix-pathinfo
cgi.fix_pathinfo=1
[...]

[...] ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok ; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting ; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting ; of zero causes PHP to behave as before. Default is 1. You should fix your scripts ; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. ; http://php.net/cgi.fix-pathinfo cgi.fix_pathinfo=1 [...]

Jika mendapat pesan You do not have a valid vim binary package installed. Please install either “vim”, “vim-enhanced” or “vim”. Itu berarti editor vim velum terinstal, jalankan saja perintah berikut untuk menginstalnya

yast2 -i vim

yast2 -i vim

dan ulangi lagi langkah diatas untuk konfigurasi php.ini

Setelah file php.ini selesai di edit sekarang kita mengedit file /etc/lighttpd/modules.conf dan uncomment baris include “conf.d/fastcgi.conf”

vi /etc/lighttpd/modules.conf

vi /etc/lighttpd/modules.conf

sehingga menjadi seperti ini

[...]
##
## FastCGI (mod_fastcgi)
##
include "conf.d/fastcgi.conf"
[...]

[...] ## ## FastCGI (mod_fastcgi) ## include "conf.d/fastcgi.conf" [...]

Terakhir kita buka /etc/lighttpd/conf.d/fastcgi.conf dan pastian mengandung baris server.modules += ( “mod_fastcgi”); dan kita keluarkan komentar untuk fastcgi.server

vi /etc/lighttpd/conf.d/fastcgi.conf

vi /etc/lighttpd/conf.d/fastcgi.conf

dan seharusnya menjadi

#######################################################################
##
##  FastCGI Module
## ---------------
##
## http://www.lighttpd.net/documentation/fastcgi.html
##
server.modules += ( "mod_fastcgi" )
 
##
## PHP Example
## For PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini.
##
## The number of php processes you will get can be easily calculated:
##
## num-procs = max-procs * ( 1 + PHP_FCGI_CHILDREN )
##
## for the php-num-procs example it means you will get 17*5 = 85 php
## processes. you always should need this high number for your very
## busy sites. And if you have a lot of RAM. :)
##
fastcgi.server = ( ".php" =>
                   ( "php-local" =>
                     (
                       "socket" => socket_dir + "/php-fastcgi-1.socket",
                       "bin-path" => server_root + "/cgi-bin/php5",
                       "max-procs" => 1,
                       "broken-scriptfilename" => "enable",
                     )
                   ),
                   ( "php-tcp" =>
                     (
                       "host" => "127.0.0.1",
                       "port" => 9999,
                       "check-local" => "disable",
                       "broken-scriptfilename" => "enable",
                     )
                   ),
 
                   ( "php-num-procs" =>
                     (
                       "socket" => socket_dir + "/php-fastcgi-2.socket",
                       "bin-path" => server_root + "/cgi-bin/php5",
                       "bin-environment" => (
                         "PHP_FCGI_CHILDREN" => "16",
                         "PHP_FCGI_MAX_REQUESTS" => "10000",
                       ),
                       "max-procs" => 5,
                       "broken-scriptfilename" => "enable",
                     )
                   ),
                )
[...]

####################################################################### ## ## FastCGI Module ## --------------- ## ## http://www.lighttpd.net/documentation/fastcgi.html ## server.modules += ( "mod_fastcgi" ) ## ## PHP Example ## For PHP don't forget to set cgi.fix_pathinfo = 1 in the php.ini. ## ## The number of php processes you will get can be easily calculated: ## ## num-procs = max-procs * ( 1 + PHP_FCGI_CHILDREN ) ## ## for the php-num-procs example it means you will get 17*5 = 85 php ## processes. you always should need this high number for your very ## busy sites. And if you have a lot of RAM. :) ## fastcgi.server = ( ".php" => ( "php-local" => ( "socket" => socket_dir + "/php-fastcgi-1.socket", "bin-path" => server_root + "/cgi-bin/php5", "max-procs" => 1, "broken-scriptfilename" => "enable", ) ), ( "php-tcp" => ( "host" => "127.0.0.1", "port" => 9999, "check-local" => "disable", "broken-scriptfilename" => "enable", ) ), ( "php-num-procs" => ( "socket" => socket_dir + "/php-fastcgi-2.socket", "bin-path" => server_root + "/cgi-bin/php5", "bin-environment" => ( "PHP_FCGI_CHILDREN" => "16", "PHP_FCGI_MAX_REQUESTS" => "10000", ), "max-procs" => 5, "broken-scriptfilename" => "enable", ) ), ) [...]

Kemudian restart lighttpd nya

/etc/init.d/lighttpd restart

/etc/init.d/lighttpd restart

5. Testing PHP5
Dokumen root untuk default website adalah /srv/www/htdocs. Sekarang kita mencoba membuat skrip php misalnya info.php pada direktori tersebut dan mencoba memanggilnya melalui web browser.

vi /srv/www/htdocs/info.php

vi /srv/www/htdocs/info.php

Buatlah skrip sederhana sebagai berikut

<!--?php phpinfo(); ?-->

<!--?php phpinfo(); ?-->

kemudian lihat pada browser dengan mengakses ip server anda, misalnya http://192.168.0.100/info.php, dan seharusnya tampil informasi seperti ini

Jika sudah tampak hasil seperti diatas maka PHP sudah bekerja dengan baik, akan tetapi belum mendapat support database MySQL.

6. Menginstal support MySQL untuk PHP5
Untuk mendapatkan support MySQL untuk PHP5, kita bisa menginstal paket php5-mysql. Akan tetapi modul-modul PHP5 yang lain yang mungkin diperlukan untuk aplikasi sebaiknya diinstal juga.

Jalankan perintah

yast2 -i php5-mysql php5-bcmath php5-bz2 php5-calendar php5-ctype php5-curl php5-dom php5-ftp php5-gd php5-gettext php5-gmp php5-iconv php5-imap php5-ldap php5-mbstring php5-mcrypt php5-odbc php5-openssl php5-pcntl php5-pgsql php5-posix php5-shmop php5-snmp php5-soap php5-sockets php5-sqlite php5-sysvsem php5-tokenizer php5-wddx php5-xmlrpc php5-xsl php5-zlib php5-exif php5-pear php5-sysvmsg php5-sysvshm

yast2 -i php5-mysql php5-bcmath php5-bz2 php5-calendar php5-ctype php5-curl php5-dom php5-ftp php5-gd php5-gettext php5-gmp php5-iconv php5-imap php5-ldap php5-mbstring php5-mcrypt php5-odbc php5-openssl php5-pcntl php5-pgsql php5-posix php5-shmop php5-snmp php5-soap php5-sockets php5-sqlite php5-sysvsem php5-tokenizer php5-wddx php5-xmlrpc php5-xsl php5-zlib php5-exif php5-pear php5-sysvmsg php5-sysvshm

kemudian restart lighttpd

/etc/init.d/lighttpd restart

/etc/init.d/lighttpd restart

Sekarang reload web browser http://192.168.0.100/info.php. Seharusnya sekarang anda menemukan banyak modul disana, termasuk modul-modul MySQL

LighttpdMigrasi ServerMySQLopenSUSE & SLESphpplanet-terasi-aggregatorServersuseWeb Server
Share

Migrasi Server  / openSUSE & SLES  / Tips, Tricks & Tutorial

Sri Rustanto

You might also like

Eskalasi Masalah Email : mailbox unavailable invalid DNS MX or A/AAAA resource record
July 14, 2020
Update Script untuk Ubuntu Initial Server Setup
April 20, 2020
Instalasi Dasar Ubuntu Server 18.04 64 bit
April 19, 2020

Comment


Milo Ballam
November 19, 2012 at 8:08 pm

click reference



Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

CAPTCHA
Refresh

*

This site uses Akismet to reduce spam. Learn how your comment data is processed.

  • Artikel



  • Blogroll

    • DNS Propagation Checker
    • Instagram Photo/Video Downloader
    • PT. Excellent Infotama Kreasindo
  • Publishing

  • Recent Posts

    • Pengalaman Saat Sakit : Keluarga, Sahabat dan Bagaimana Jika…
    • Refleksi Setelah Sakit
    • Legacy
    • Bitcoin, Ethereum, Dogecoin
    • Penjualan Langsung : Keliling dan Mangkal
    • Perkembangan Usaha Penjualan Pisang “Zeze Zahra” Setelah 1 Bulan
    • Bekerja Keras dan Responsif
    • Bank Syariah Indonesia
    • Meningkatkan Nilai Tambah & Daya Tarik
    • Kios Aneka Pisang “Zeze Zahra II”