#
Sunday, July 14, 2013
no image

Install Varnish, Nginx, with Apache di kloxo, CentOS5.6

Anda ingin Install Varnish, Nginx, with Apache di kloxo, CentOS5.6? Pertama2 import repo dari epel
rpm -Uvh http://download.fedora.redhat.com/pub/epel/5Server/i386/epel-release-5-4.noarch.rpm
yum install nginx
lalu edit nginx.conf
nano /etc/nginx/nginx.conf
user nginx;
worker_processes 2;
error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;
pid /var/run/nginx.pid;
events {
worker_connections 1024;
}
http {
include /etc/nginx/mime.types;
default_type application/octet-stream;
log_format main ‘$remote_addr – $remote_user [$time_local] $request ‘
‘”$status” $body_bytes_sent “$http_referer” ‘
‘”$http_user_agent” “$http_x_forwarded_for”‘;
access_log /var/log/nginx/access.log main;
sendfile on;
tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
gzip on;
# Load config files from the /etc/nginx/conf.d directory
include /etc/nginx/conf.d/*.conf;
#
# The default server
#
server {
listen 8080;
server_name default;
access_log /var/log/nginx/access.log;
# Main location
location / {
proxy_pass http://127.0.0.1:8081; #Ganti 127.0.0.1 dengan ip vps
proxy_redirect off;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
client_max_body_size 10m;
client_body_buffer_size 128k;
proxy_connect_timeout 90;
proxy_send_timeout 90;
proxy_read_timeout 90;
proxy_buffer_size 4k;
proxy_buffers 4 32k;
proxy_busy_buffers_size 64k;
proxy_temp_file_write_size 64k;
}
}
}
save terus check nginx nya
root$server~]:nginx -t
the configuration file /etc/nginx/nginx.conf syntax is ok
configuration file /etc/nginx/nginx.conf test is successful
Lalu install varnish vache
import repo varnish
rpm –nosignature -i http://repo.varnish-cache.org/redhat/varnish-3.0/el5/noarch/varnish-release-3.0-1.noarch.rpm
terus install varnish via yum
yum install varnish
terus edit /etc/sysconfig/varnish
nano /etc/sysconfig/varnish
cari VARNISH_LISTEN_PORT=6081 // ganti port varnish 6081 menjadi 80
VARNISH_LISTEN_PORT=80
terus edit /etc/varnish/default.vcl
nano /etc/varnish/default.vcl
# This is a basic VCL configuration file for varnish. See the vcl(7)
# man page for details on VCL syntax and semantics.
#
# Default backend definition. Set this to point to your content
# server.
#
backend default {
.host = “127.0.0.1″; #ganti 127.0.0.1 sama ip vps anda
.port = “8080″; #port nginx
}
#
# Below is a commented-out copy of the default VCL logic. If you
# redefine any of these subroutines, the built-in logic will be
# appended to your code.
sub vcl_recv {
if (req.restarts == 0) {
if (req.http.x-forwarded-for) {
set req.http.X-Forwarded-For =
req.http.X-Forwarded-For + “, ” + client.ip;
} else {
set req.http.X-Forwarded-For = client.ip;
}
}
if (req.request != “GET” &&
req.request != “HEAD” &&
req.request != “PUT” &&
req.request != “POST” &&
req.request != “TRACE” &&
req.request != “OPTIONS” &&
req.request != “DELETE”winking {
/* Non-RFC2616 or CONNECT which is weird. */
return (pipe);
}
if (req.request != “GET” && req.request != “HEAD”winking {
/* We only deal with GET and HEAD by default */
return (pass);
}
if (req.http.Authorization || req.http.Cookie) {
/* Not cacheable by default */
return (pass);
}
return (lookup);
}
sub vcl_pipe {
# Note that only the first request to the backend will have
# X-Forwarded-For set. If you use X-Forwarded-For and want to
# have it set for all requests, make sure to have:
# set bereq.http.connection = “close”;
# here. It is not set by default as it might break some broken web
# applications, like IIS with NTLM authentication.
return (pipe);
}
sub vcl_pass {
return (pass);
}
sub vcl_hash {
hash_data(req.url);
if (req.http.host) {
hash_data(req.http.host);
} else {
hash_data(server.ip);
}
return (hash);
}
sub vcl_hit {
return (deliver);
}
sub vcl_miss {
return (fetch);
}
sub vcl_fetch {
if (beresp.ttl <= 0s ||
beresp.http.Set-Cookie ||
beresp.http.Vary == “*”winking {
/*
* Mark as “Hit-For-Pass” for the next 2 minutes
*/
set beresp.ttl = 120 s;
return (hit_for_pass);
}
return (deliver);
}
sub vcl_deliver {
return (deliver);
}
sub vcl_error {
set obj.http.Content-Type = “text/html; charset=utf-8″;
set obj.http.Retry-After = “5″;
synthetic {”
<?xml version=”1.0″ encoding=”utf-8″?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Strict//EN”
“http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd”>
<html>
<head>
<title>”} + obj.status + ” ” + obj.response + {“</title>
</head>
<body>
<h1>Error “} + obj.status + ” ” + obj.response + {“</h1>
<p>”} + obj.response + {“</p>
<h3>Guru Meditation:</h3>
<p>XID: “} + req.xid + {“</p>
<hr>
<p>Varnish cache server</p>
</body>
</html>
“};
return (deliver);
}
sub vcl_init {
return (ok);
}
sub vcl_fini {
return (ok);
}
Simpan
terus edit apache kloxo virtualhostnya
di /etc/httpd/conf/httpd.conf
Cari Listen 80 ganti menjadi
Listen 10.10.10.10:8081 #10.10.10.10 ganti dengan ip vps anda klo misalkan multy ip nya tambahkan saja listen nya contoh
Listen 0.0.0.0:8081
lalu edit /etc/httpd/conf/kloxo/default.conf
nano /etc/httpd/conf/kloxo/default.conf
<VirtualHost \
IPVPS1ANDA:8081\
IPVPS2ANDA:8081\
>
DocumentRoot /home/kloxo/httpd/default/
servername default
ServerAlias default.*
<Ifmodule mod_userdir.c>
Userdir “public_html”
</Ifmodule>
</VirtualHost>
edit /etc/httpd/conf/kloxo/init.conf
port nya menjadi 8081 yg ssl biarin aja
edit /etc/httpd/conf/kloxo/webmail.conf
ganti port 80 menjadi 8081
lalu liat /etc/httpd/conf/kloxo/virtualhost.conf
cat /etc/httpd/conf/kloxo/virtualhost.conf
ganti semua port 80 menjadi 8081 di
nano /home/httpd/domain.us/conf/kloxo.domain.us
klo suda selesai lalu
service httpd restart
service nginx restart
service varnish restart
Sekian dan terima kasi Semoga bermanfaat
Read More
Setting Firewall Camfrog pada Server Centos

Setting Firewall Camfrog pada Server Centos


Camfrog saat ini menjadi sangat populer di kalangan pengguna internet di Indonesia, hal ini di sebabkan fasilitas yang ada di dalam service camfrog ini yang mampu di jadikan alat komunikasi secara live menggunakan kamera video, sehingga jarak bukan menjadi halangan lagi.

Terkait dengan layanan tersebut, ternyata menjadi peluang untuk menyediakan layanan server camfrog yang menjadikannya sebagai sumber penghasilan.

Bagaimana cara setting firewall untuk server camfrog Anda tersebut? Jika Anda belum memiliki server, Anda dapat menggunakan layanan vps murah atau dedicated server murah dari dutaspace.com untuk mengikuti panduan berikut.
  • Cara pertama Setting Firewall Camfrog Server on linux dengan IPTABLES Standart
echo 1 > /proc/sys/net/ipv4/tcp_syncookies
iptables -A INPUT -p tcp –dport 22 -j ACCEPT #SSH PORT
iptables -A INPUT -p tcp –dport 2000:3000 -j ACCEPT
iptables -A INPUT -p tcp –dport 6000:6010 -j ACCEPT #Port Camfrog
iptables -A INPUT -p tcp –dport 5999 -j ACCEPT #Web Panel
iptables -A INPUT -p udp –dport 5000:15000 -j ACCEPT #UDP Camfrog
iptables -A INPUT -p tcp –tcp-flags ALL NONE -j DROP
iptables -A INPUT -p tcp –tcp-flags SYN,FIN SYN,FIN -j DROP
iptables -A INPUT -p tcp –tcp-flags SYN,RST SYN,RST -j DROP
iptables -A INPUT -p tcp –tcp-flags FIN,RST FIN,RST -j DROP
iptables -A INPUT -p tcp –tcp-flags ACK,FIN FIN -j DROP
iptables -A INPUT -p tcp –tcp-flags ACK,PSH PSH -j DROP
iptables -A INPUT -p tcp –tcp-flags ACK,URG URG -j DROP
iptables -A INPUT -m state –state INVALID -j DROP
iptables -A OUTPUT -m state –state INVALID -j DROP
iptables -A FORWARD -m state –state INVALID -j DROP
iptables -A INPUT -p tcp ! –syn -m state –state NEW -j DROP
iptables -A INPUT -p tcp –tcp-flags ALL ALL -j DROP
iptables -A INPUT -p tcp –tcp-flags ALL NONE -j DROP
iptables -N syn-flood
iptables -A syn-flood -m limit –limit 1/second –limit-burst 4 -j RETURN
iptables -A syn-flood -j DROP
iptables -N udp-flood
iptables -A udp-flood -m limit –limit 4/second –limit-burst 4 -j RETURN
iptables -A udp-flood -j DROP
iptables -A INPUT -i eth0 -p tcp –tcp-flags  SYN,RST,ACK,FIN SYN,ACK -j syn-flood
iptables -A INPUT -i eth0 -p tcp ! –syn -m state –state NEW -j DROP
iptables -A INPUT -i eth0 -p udp -j udp-flood
iptables -A INPUT -i eth0 -f -j DROP
iptables -A INPUT -p icmp –icmp-type echo-request -j DROP
service iptables save
  • Cara Kedua Setting APF Firewall + IPTABLES + DDOS DEFLATE Untuk Camfrog Server di Linux
#cd /usr/src
#mkdir utils
#cd utils
#wget http://rfxnetworks.com/downloads/apf-current.tar.gz
#tar xfz apf-current.tar.gz
#cd apf-*
#./install.sh
dan edit bagian ini /etc/apf/conf.apf
#nano /etc/apf/conf.apf
#DEVEL_MODE=”0″
#IG_TCP_CPORTS=”22,2000_3000,6000_6010,5999″
#IG_UDP_CPORTS=”2000_3000,5000_15000″
#USE_AD=”1″
#apf –start
Brute Force Detection
#cd /usr/src/utils
#wget http://rfxnetworks.com/downloads/bfd-current.tar.gz
#tar xfz bfd-current.tar.gz
#cd bfd-*
#./install.sh
Edit /usr/local/bfd/conf.bfd
#nano /usr/local/bfd/conf.bfd
#cari EMAIL_USR=”root” dan ganti dengan EMAIL_USR=”user@emailkamu.tld”
#/usr/local/sbin/bfd -s
DDOS DEFLATE
#cd /usr/src/utils
#mkdir ddos
#cd ddos
#wget http://www.inetbase.com/scripts/ddos/install.sh
#sh install.sh
Edit konfigurasi file, /usr/local/ddos/ddos.conf,
#nano /usr/local/ddos/ddos.conf
#/usr/local/ddos/ddos.sh -c
Tambahkan bagia ini di /etc/rc.d/rc.local supaya setiap reboot/restart server aktif
#/usr/local/sbin/apf –start
#/usr/local/ddos/ddos.sh -c
Read More
Copyright © 2016 Review Hosting All Right Reserved.