Monday, May 11, 2015

How to Install and Configure Squid Proxy Server on Windows


Here I am using windows XP. In this example, I am using small LAN network and two Internet connection. First Internet connection is connected through switch, it is used as direct connection. Second internet connection is used in the server using squid proxy.  Squid Server has two NIC cards, one is connected to LAN and another one is connected to WAN (Internet). Here LAN connected to switch and WAN connected to ISP modem. 

LAN  => 192.168.0.100 (Static configuration)
WAN => 192.168.58.129 ( DHCP Configuration)
Step 1 - First, check the system LAN configuration details.

Step 2 - Download Squid Proxy from internet. 
URL : squid.amceconsulting.it

Step 3 - After downloading, go to downloaded location and extract. Then copy the extracted folder "squid" to c:\ drive.

Step 4 - Now, we need to change some default configuration.

Step 5 - After that, go to "Command Prompt" and redirect to "c:\squid\sbin" directory and run this command "squid -i". This command used for adding squid service to registry.

Step 6 - Now, we want to create squid swap/cache directory, for that run "squid -z". 

The swap folder is added. Go to "c:\squid\var\" directory, here we can see the "cache" directory.

Step 7 - Now we need to go to "Windows Services" section to start the squid service. Go to Control Panel => Administrative Tools => Services. Here we need to enable "Automatic" option for the service start booting time.

Step 8 - To check squid service is running or not, go to Windows Task Bar => Process => Squid.exe

Step 9 - Now we need to configure squid server, open squid configuration file. Go to "c:\squid\etc\squid.conf" and change some default settings. In this file, we can add our own rules (acl) to add specific IP-Address, Block Sites and Block Downloading, etc. 

Step 10 - After configuration, restart the squid service.
Note : If you want to change any settings, restart the service after changing.

Step 11 - Now, check the internet connection on server is working or not by using the browser. Before that, we need to change some settings on browser.

Step 12 - Now, we want to go to client side, first check the LAN settings and configure proxy setting on browser.

Here, ping option not responding because internet working through browser. 

My Configuration Example :

acl IP-Range src 192.168.0.0/24
acl Admin src "C:\squid\etc\Admin-IP.conf"
acl LAN1 src "C:\squid\etc\Lan1-IP.conf"
acl Block-URL dst "C:\squid\etc\Ban-Site.conf"
acl Blocak-Domain dstdomain "C:\squid\etc\Block-Domain.conf"
acl Bloack-keyword url_regex "C:\squid\etc\Keywords.conf"

acl SSL_ports port 443
acl SSL_ports port 10000        # Webmin
acl SSL_ports port 2082-2099 # WHM/Cpanel
acl Safe_ports port 80 # http
acl Safe_ports port 20-21 # ftp
acl Safe_ports port 443 # https
acl Safe_ports port 70 # gopher
acl Safe_ports port 210 # wais
acl Safe_ports port 1025-65535 # unregistered ports
acl Safe_ports port 280 # http-mgmt
acl Safe_ports port 488 # gss-http
acl Safe_ports port 591 # filemaker
acl Safe_ports port 777 # multiling http
acl CONNECT method CONNECT

# Only allow cachemgr access from localhost
http_access allow manager localhost
http_access deny manager

# Deny requests to unknown ports
http_access deny !Safe_ports

# Deny CONNECT to other than SSL ports
http_access deny CONNECT !SSL_ports

# And finally deny all other access to this proxy
#http_access deny all
http_access allow Admin
http_access allow LAN1
http_access deny Block-URL !Admin
http_access deny Blocak-Domain !Admin
http_access deny Bloack-keyword !Admin

# DISK CACHE OPTIONS
cache_dir ufs c:/squid/var/cache 4000 16 256

# MEMORY CACHE OPTIONS
cache_mem 64 MB

# ADMINISTRATIVE PARAMETERS
cache_mgr network@reubro.com

# DNS OPTIONS
dns_nameservers 8.8.8.8 8.8.4.4

# NETWORK OPTIONS
http_port 3128
reply_body_max_size 150 MB all !Admin

# ADMINISTRATIVE PARAMETERS
visible_hostname localhost


That's it...

Sunday, May 10, 2015

How to use EasyApache Script on Linux

How to use EasyApache Script and install php-mbstring extension use with Easy Apache

When configuring a website to work with different languages on a Linux server, the mbstring extension will need to be installed on the server for the website functionality to work. we must have Root access on your VPS or Dedicated server. If you are on a shared server, you will need to contact support to have the extension installed.

Step 1 - Check your server for the php-mbstring extension installed or not. If the results show nothing, then the php-mbstring is not installed on the server.

Step 2 - Here, we are using VPS server, in this case we need to run on "screen" command, this is for secure installation EasyApache. EasyApache script running time internet connection lost the build may be corrupted. Start a screen session and check it is working.

Step 3 - Now, we need to run "EasyApache" script on screen command line  "/scripts/easyapache". When you get the "cPanel update available" box saying "would you like to update now," select "No" and hit Enter.

Step 4 - Here, select default section and click on "Customize Profile".

Step 5 - In this window we can see the Apache version and if needed we can update the version. Here I have selected the default Apache version and click on "Next Step".

Step 6 - In this case also, use the same procedure of Apache and click on "Next Step".

Step 7 - The "Short Options List"will appear. Select "Exhaustive options list" and hit Enter.

Note : Here I am enabling php-mbstring, if you need to install some software you can select accordingly. 

Step 8 - In this windows, go to page down till you see the "Mbstring" extension listed by using down arrow and  click on space bar to select the Mbstring and click on Next.

Step 9 - Now the server will ask "What do you want to do now?" select "Save and Build" and hit enter. In the Confirm build screen, select "Yes" and hit Enter.

Step 10 - Easy Apache will finally ask to Please acknowledge, select "I Understand" and hit Enter.

Step 11 - Apache and PHP will now rebuild and wait for the process to finish. The process time can vary. However, typically it should take 10 to 30 minutes. Once the process is finished, after all check your phpinfo.php. You can see the Mbstring extension in the phpinfo page now.

Step 12 - After successful installation of php-mbstring, exit from screen command line. You can use CTRL+a and then 'k' will kill a screen session or use below command.

That's it...

Saturday, May 9, 2015

How to create Database and User in Cpanel Account


In this example, I am going to create a new Database and User, then assign user to database. Also, how to Export local Database and Import to the newly created server using with phpMyAdmin.


Step 1 - First Login to cpanel account and go to "Databases" section and select "Mysql Databases".

Step 2 - After click on Mysql Databases, create new Database.

Now we can see the Database in this window.

Step 3 - After creating Database, we need to create new database user.

Step 4 - After all, we need to assign new user to newly created Database.

Then allow which privileges options that the user needs. Here I have selected all options and click on "Make Changes".

Now we can see that the user is assigned to the database.

Step 5 - We need to export database from the local server, by using the following steps.

Step 6 - After exporting, we need to go live server and import the exported database to newly created server.


That's it...