Showing posts with label Apache. Show all posts
Showing posts with label Apache. Show all posts

Saturday, February 13, 2010

Optimize PHP Linux Web Server

Open php.ini configuration file.
vi /etc/php.ini
Find and change to following value:-
max_execution_time = 30
max_input_time = 30
memory_limit = 40M
post_max_size = 8M
upload_max_filesize = 2M
file_uploads = Off (Turn off if it really not use.)
cgi.force_redirect = 0
allow_url_fopen = Off
sql.safe_mode = Off
Reload Apache, using following command:-
server httpd reload
or
/etc/init.d/httpd reload

Friday, February 06, 2009

Unable to start apache after make some changes

Unable to start apache after make some changes? by default apache have config file syntax checking. You can execute below command to check you syntax.
# httpd -t
# httpd -S

If the syntax of the output will look like this:-
Syntax OK

it mean you configure correctly.

If the out put similar with this,
Syntax error on line 44 of /etc/apache/httpd.conf:
bla...bla...bla.....

correct the syntax and try start again:-
# vi +44 /etc/apache/httpd.conf

For more info ,check log file :-


tail -f /var/log/httpd-error.log

egrep -i 'warn|error' /var/log/httpd-error.log

Wednesday, February 04, 2009

How to make SYN flood (basic)

What is SYN flood?

A SYN flood is a form of denial-of-service attack in which an attacker sends a succession of SYN requests to a target's system. (read more)

Download hping (http://www.hping.org/)

Debian / ubuntu
#sudo apt-get install hping

Use this commnad to execute attack:-
sudo hping - -faster -S <ip address or domain name>

For batter result, get ethernet packet generator ( http://packeth.sourceforge.net/)

Sunday, January 25, 2009

Optimize Apache & MySQL for Low Memory Systems

Optimize Apache for Low memory Server

/etc/httpd/conf/httpd.conf

KeepAlive On
KeepAliveTimeout 3
<IfModule prefork.c>
StartServers       2
MinSpareServers    2
MaxSpareServers    5
ServerLimit      100
MaxClients       100
MaxRequestsPerChild  500
</IfModule>
<IfModule worker.c>
StartServers         2
MaxClients         150
MinSpareThreads     15
MaxSpareThreads     50
ThreadsPerChild     15
MaxRequestsPerChild  0
</IfModule>

Optimize MySQL for Low Memory Server

/etc/my.cnf

[mysqld]
port               = 3306
socket             = /var/lib/mysql/mysql.sock
skip-locking
key_buffer         = 16K
max_allowed_packet = 1M
table_cache        = 4
sort_buffer_size   = 64K
read_buffer_size   = 256K
read_rnd_buffer_size = 256K
net_buffer_length  = 2K
thread_stack       = 64K

How to enable 'Register Globals'

How to enable 'Register Globals'

register_globals is disabled by default on all servers. This provides greater security on the server and makes it more difficult for hackers to exploit scripts. However, some old scripts still need register_globals enabled to work.

1. Create a file .htaccess
2. Insert the following line into .htaccess

php_flag register_globals on

3. Upload the file into /public_html/ directory