Archive for the ‘Linux’ Category

Enabling FP extensions for an addon domain

Thursday, May 3rd, 2007

HowTo enable FP extensions for an addon domain
——————————————————————-
A) We won’t be able to install FP extensions on addon domain basically for
two reasons.

1) There won’t be a ServerName entry for the addon domain in the Apache config file and hence the install program will show an error like
the “domain” is not a valid virtual server.

2) FrontPage extension install program won’t install extensions in a directory which comes under another domains web root having FP extensions already installed.

To overcome these hurdles you can do the following.

1) Comment out the existing ServerName entry for the subdomain.

2) Create a new ServerName entry for <www.addondomain> in the corresponding subdomain’s VirtualHost entry.

3) Create a temporary folder in the document root of main domain and MOVE all .htaccess* and _* files from public_html in to the new directory.

4) Remove the _* and .htaccess files(created by FP) from the addon domain’s folder.

5) Verify the access.conf file in apache config directory and ensure that the AllowOverride directive is set to ‘All’. Some times this will not be enough for us to continue, hence, you have to make sure that the AllowOverride is set to ‘All’(by default it will
be ‘None’) in Apache config file.
Change only the directive inside <Directory “/usr/local/apache/htdocs”> entry.

6) Restart Apache and run the install program from back end.

#/usr/local/frontpage/version5.0/bin/owsadm.exe -o install -u $USERNAME -xuser $USERNAME -xgroup $USERNAME -p 80 -m $DOMAIN -pw $PASSWORD -s /usr/local/apache/conf/httpd.conf
where
$USERNAME give control panel login name
$DOMAIN give addon domain use www.addon.com
$PASSWORD choose a password

7) Restore the changes you made in the Apache config file.

Cool Move the .htaccess* and _* files from the backup directory (main domain web root).

If you are still having problems with connecting to the server using
FrontPage please make sure that the server name is http://www.addondomainname and you may also want to close the FP program and
start again to clear cache.

Enjoy

Ninad

CentOS 5 released :)

Saturday, April 28th, 2007

Cent OS 5 is released now — check out details here

http://lists.centos.org/pipermail/centos-announce/2007-April/013660.html

Here is some help upgrading to CentOS 5 —
http://wiki.centos.org/Migration/5

Cheers …

How to access PHP5 ?

Saturday, April 28th, 2007

How to access PHP5 on your server if you have both PHP4 and PHP5 installed.

You can enabled PHP5 on particular domain by adding following line in .htaccess under public_html folder –

AddType application/x-httpd-php5 .php

Thank you :)

Installing and Configure Squid Proxy Server

Friday, April 27th, 2007

Here are the simple steps to install squid –

Login as root and execute,

cd /usr/local/src
wget http://www.squid-cache.org/Versions/v2/2.5/squid-2.5.STABLE14.tar.gz
tar -zxvf squid-2.5.STABLE14.tar.gz
cd squid-2.5.STABLE14
./configure –prefix=/usr/local/squid –disable-ident-lookups
make all
make install

Add the user squid, create the cache directory and then set permissions.

useradd -d /usr/local/squid/cache/ -r -s /dev/null squid >/dev/null 2>&1
mkdir /usr/local/squid/cache
chown -R squid:squid /usr/local/squid/cache
chown -R squid:squid /usr/local/squid
chmod -R 755 /usr/local/squid/cache

Now generate the cache files

sudo -u squid /usr/local/squid/sbin/squid -z

Now lets change the cache effective user and group to squid.

perl -pi -e ‘s/# cache_effective_user nobody/cache_effective_user squid\ncache_effective_group squid/g’ /usr/local/squid/etc/squid.conf

/usr/local/squid/sbin/squid

You are done installing …

Configuration

Open the squid configuration,

pico /usr/local/squid/etc/squid.conf

specific your http_port, by default this is 3128, we will use 8080.

Find

# http_port 3128

and replace it with

http_port 8080

Now lets configure who can access your proxy, remember to only allow access to YOUR ip.

Find

http_access deny CONNECT !SSL_ports

Add below

acl myip 127.0.0.1
acl all src 0.0.0.0/0.0.0.0
acl connectmethod method CONNECT
http_access deny connectmethod
http_access deny all
http_access allow myip

Remember to replace 127.0.0.1 with the ip you want to allow access.

Find

# By default, all headers are allowed (no anonymizing is
# performed).
#
#Default:
# none

Add below

header_access From deny all
header_access Referer deny all
header_access Server deny all
header_access User-Agent deny all
header_access WWW-Authenticate deny all
header_access Link deny all
header_access via deny all

Find

# forwarded_for on

Replace with

forwarded_for off

Save and exit squid.conf, then restart squid.

kill -9 $(ps aux | grep squid | awk ‘{print $2}’)
/usr/local/squid/sbin/squid

You have now configured an anoymous proxy with squid.

Thanks to HOstgeekz :)

Useful MYSQL tips ..

Friday, April 27th, 2007

Check this —

http://souptonuts.sourceforge.net/readme_mysql.htm

Command to know the performance of your HardDisk.

Friday, April 27th, 2007

Here you go –

hdparm -Tt /dev/sda

Note: The command “hdparm” isn’t always compatible with hardware raid (3ware SATA or Dell SCSI PERC 320/DC adapters)

Simple commad to fetch RAM Information on your server.

Friday, April 27th, 2007

Linux

free -m

free -k

cat /proc/meminfo

Windows

windows control panel -> system -> right in the general tab on the bottom.

Thank you :)

Banning / Unbanning / Listing ips.

Friday, April 27th, 2007

Banning an IP
iptables -I INPUT -s [ipaddress] -j DROP

Unbanning and IP
iptables -I INPUT -s [ipaddress] -j ACCEPT

Listing the last five ip’s with the most connections
netstat -atnp -A inet | grep “:80″ | awk -F ” ” ‘{print $5} ‘ | awk -F “:” ‘{print $1}’ | sort | uniq -c | sort -nr | head -5

Listing total connections
netstat -nap | grep ESTABLISHED | wc -l
netstat -nap | grep SYN | wc -l
netstat -nap | grep TIME_WAIT | wc -l

———-

If Apf firewall is installed on server then –

Accept IP –
apf -a [ip address]

Decline IP –

apf -d [ip address]

———–
IF shorewall is installed

Decline Ip –

shorewall drop [ip address]

PHP5 install as CGI

Friday, April 27th, 2007

1) Download PHP 5.1.2 and do the usual

cd /usr/local/src

http://www.php.net/get/php-5.2.1.tar.bz2/from/a/mirror

tar -jxvf php-5.2.1.tar.bz2

2) Compile php as in a new directory such as /usr/local/php5

Use the same ./configure line required but with the following changes:

–with-config-file-path=/usr/local/php5/etc –prefix=/usr/local/php5 –with-mysqli=/usr/bin/mysql_config (only with Mysql 4.1)

3) Compile and install
make
make install

IMP Steps :

cp php.ini-dist /usr/local/php5/etc/php.ini
cp /usr/local/php5/bin/php /usr/local/cpanel/cgi-sys/php5
chown root:wheel /usr/local/cpanel/cgi-sys/php5

4) Edit httpd.conf and add lines below::

AddHandler application/x-http-php5 .php5
Action application/x-http-php5 /cgi-sys/php5

Just use .php5 and it will invoke php5.

Enjoy

Ninad

Disable PHP Functions

Thursday, April 26th, 2007

Edit php.ini

Comment out the original disable_functions, then put this underneath

disable_functions = dl,passthru,proc_open,proc_close,shell_exec,system

/etc/rc.d/init.d/httpd restart

Enjoy

Ninad