Apa sih nginx? Nginx adalah webserver sama seperti Apache dan Lighttpd, mungkin bedanya seperti yang saya cari di paman google, klo nginx banyak yang bilang lebih powerfull n lebih cepet, dibandingkan dengan Apache ataupun Lighttpd.
Disini saya akan melakukan instalasi Nginx di LinuxMint 8 (Helena) yang merupakan turunan dari ubuntu 9.10 (Karmic Koala).
Yang pertama kita Instalasi Nginx terlebih dahulu
sudo apt-get install nginxatau bila kita ingin menggunakan source code
sudo wget http://sysoev.ru/nginx/nginx-0.6.36.tar.gzuntuk settingan di ubuntu ataupun turunannya
tar -xzvf nginx-0.6.36.tar.gz
cd nginx-0.6.36.tar.gz
sudo apt-get install build-essential
./configure
make
sudo make install
./configure –conf-path=/etc/nginx/nginx.conf \Setelah itu jalankan nginx
–error-log-path=/var/log/nginx/error.log –pid-path=/var/run/nginx.pid \
–lock-path=/var/lock/nginx.lock –http-log-path=/var/log/nginx/access.log \
–http-client-body-temp-path=/var/lib/nginx/body –http-proxy-temp-path=/var/lib/nginx/proxy \
–http-fastcgi-temp-path=/var/lib/nginx/fastcgi –with-debug –with-http_stub_status_module \
–with-http_flv_module –with-http_ssl_module –with-http_dav_module
make
sudo make install
sudo /etc/init.d/nginx startAgar setiap booting nginx dapat langsung berjalan
sudo update-rc.d nginx defaultsUntuk melihat apakah nginx telah berjalan ketikkan localhost pada browser.
Selanjutnya kita install paket php
sudo apt-get install php5-cgi php5-mysql php5-curl php5-gd php5-idn php-pear php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xslUbah cgi.fix_pathinfo = 0 menjadi 1
kemudian edit file /etc/php5/cgi/php.ini
sudo gedit /etc/php5/cgi/php.ini
[...]Kemudian install
cgi.fix_pathinfo = 1
sudo apt-get install spawn-fcgigunakan perintah berikut untuk menjalankan php cgi
sudo /usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pidtambahkan perintah di pada /etc/rc.local
[...]edit file nginx.conf
/usr/bin/spawn-fcgi -a 127.0.0.1 -p 9000 -u www-data -g www-data -f /usr/bin/php5-cgi -P /var/run/fastcgi-php.pid
[...]
sudo gedit /etc/nginx/nginx.confedit bagian berikut
[...]Selajutnya mengubah path file default sesuai keinginan kita
worker_processes 5;
[...]
keepalive_timeout 2;
[...]
sudo gedit /etc/nginx/sites-available/default
[...]
server {
listen 80;
server_name localhost;
access_log /var/log/nginx/localhost.access.log;
location / {
#root /var/www/nginx-default;
root /home/vq/public_html;
index index.php index.html index.htm;
}
location /doc {
root /usr/share;
autoindex on;
allow 127.0.0.1;
deny all;
}
location /images {
root /usr/share;
autoindex on;
}
#error_page 404 /404.html;
# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
#root /var/www/nginx-default;
root /home/vq/public_html;
}
# proxy the PHP scripts to Apache listening on 127.0.0.1:80
#
#location ~ \.php$ {
#proxy_pass http://127.0.0.1;
#}
# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
#
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME /home/vq/public_html$fastcgi_script_name;
include fastcgi_params;
}
# deny access to .htaccess files, if Apache’s document rootTerakhir kita tinggal melakukan restart nginx
# concurs with nginx’s one
#
location ~ /\.ht {
deny all;
}
}
[...]
sudo /etc/init.d/nginx restartUntuk melihat apakah php-nya sudah berjalan
sudo gedit /home/vq/public_html/info.phpisi file info.php dengan kode berikut
i was glancing for hire codeigniter programmers and encounter your column and i ought say this is relatively practical for me thank you for sharing.
ReplyDeleteThank you for the comments, I would like to share about the CodeIgniter library for the template to you in https://github.com/agusprasetyo811/omap-ci. :) Sorry my English bad. Hopefully it can help
Delete