Sei sulla pagina 1di 3

3proxy install on Ubuntu AMI

by Dmitri (contact@sysadmin.md)
Download and unpack 3proxy
mkdir 3proxy 
cd 3proxy 
wget http://3proxy.ru/current/3proxy­0.7­devel.tgz 
tar zxf 3proxy­0.7­devel­100812103505.tgz 

Compile and install it


cd 3proxy­0.7­devel
make ­f Makefile.Linux
make ­f Makefile.Linux install

Create directories
mkdir /usr/local/3proxy
mkdir /usr/local/3proxy/logs
mkdir /usr/local/3proxy/stat

Copy files and setup 3proxy to start at boot


cp src/3proxy /usr/local/3proxy
cp cfg/3proxy.cfg.sample /usr/local/3proxy/3proxy.cfg
cp ./scripts/rc.d/proxy.sh /etc/init.d/3proxy
chown ­R nobody:nogroup /usr/local/3proxy
update­rc.d 3proxy defaults

Cleanup
cd ~ 
rm ­rf 3proxy*

Configuration
The file /usr/local/3proxy/3proxy.cfg should look like this one
!/usr/local/3proxy/3proxy

# Use Google nameservers
nserver 8.8.8.8
nserver 8.8.4.4
# nscache is good to save speed, traffic and bandwidth
nscache 65536

# Here we can change timeout values
timeouts 1 5 30 60 180 1800 15 60

users dmitri:CL:test123
# now we will not depend on any console (daemonize)
daemon

# log allows to specify log file location and rotation, D means logfile
# is created daily
log /var/log/3proxy.log D
logformat "L%d­%m­%Y %H:%M:%S %z %N.%p %E %U %C:%c %R:%r %O %I %h %T"

# We will keep last 30 log files
rotate 30

# HTTP
auth strong
# We want to protect internal interface
deny * * 127.0.0.1
# and llow HTTP and HTTPS traffic.
allow * * * 80­88,8080­8088 HTTP
allow * * * 443,8443 HTTPS
allow * * * 21 FTP
proxy ­n

# SOCKS
auth strong
flush
allow dmitri
maxconn 20
socks

# Admin interface
auth strong
flush
internal 0.0.0.0
allow dmitri *
maxconn 3
admin ­p8888

counter /usr/local/3proxy/3proxy.3cf
chroot /usr/local/3proxy
setgid 65535
setuid 65535

For more details about configuration options check the template cfg/3proxy.cfg.sample
The file /etc/init.d/3proxy should look like this one:
#!/bin/sh
#
# chkconfig: 2345 20 80
# description: 3proxy tiny proxy server
#              
case "$1" in
  start)    
      echo Starting 3Proxy
      /usr/local/3proxy/3proxy /usr/local/3proxy/3proxy.cfg
      RETVAL=$?
      echo
      [ $RETVAL ]    
     ;;

  stop)
      echo Stopping 3Proxy
              /usr/bin/killall ­9 3proxy
  
      RETVAL=$?
      echo
      [ $RETVAL ]
      ;;
  *)
      echo Usage: $0 "{start|stop}"
      exit 1
esac
exit 0

Launching and stopping


Run from shell:
/etc/init.d/3proxy start
/etc/init.d/3proxy stop

Browser setting
http ­ <hostname from Public DNS field>:3128 
socks ­ <hostname from Public DNS field>:1080
admin interface ­ http://<hostname from Public DNS field>:8888

Potrebbero piacerti anche