Archive for the ‘Apache’ Category

Nov
10
2009

Query string limit in GET data and Size limit in POST Data

RFC 2616 – Section 3 states:

“Servers should be cautious about depending on URI lengths above 255 bytes because some older client or proxy implementations may not properly support these lengths.”

Different browser agents support different URI length acceptance. In addition, servers too play a role in accepting/denying URI’s over certain length which may either truncate the URI or may give lengthy URI message indications.

It is always advisable to rely on shorter URI’s and to post data when more field sets are to be transferred across web pages.

POST data too has its limit. In this case, it is the size of the data which is controlled by the server settings.

Some interesting discussions:

Limit on query string GET URL parameters

  • Share/Save/Bookmark
Sep
10
2009

Generating Certificate for validation (CSR generation)

In order to install SSL certificates on your Apache server you need to generate a key pair and a CSR (certificate signing request) as the first step. The following points will guide you in the creation of CSR file.

Once you finish generating the CSR file, you need to paste the content of the CSR file on to the SSL certificate request page in order for the certificate authorities to start their verification process.

Command line prompts in a Linux box

Find where openssl is installed and navigated to that directory
$ whereis openssl

Mostly it will be at /usr/bin/. If it is in a different path, then navigate to that directory path
$ cd /usr/bin
(more…)

  • Share/Save/Bookmark
Aug
30
2009

Apache Error Log

Apache Error Log Expected “</File> but saw </Files>”

Check the error log file (in ubuntu it is in /var/log/apache2/error.log) for the above stated error message. Check the .htaccess file or the apache configuration files where you have restricted file permission using File Directive.

  • Share/Save/Bookmark
Aug
16
2009

Premature end of script headers: apache error

Apache errors and the approach to solve it

Premature end of script headers
500 Internal Server Error
The specified CGI application misbehaved by not returning a complete set of HTTP headers.

Some troubleshooting tips:

i) Check /var/log/apache2/error.log (in ubuntu, check the respective apache error log location for the messages)

ii) Check if the content type of the page is correctly set for the html content output.

print “Content-type: text/html\n\n”;

iii) Check if a valid permission has been given for the file to get executed. The file need permission 755 for it to be executed on the server.

iv) Check if the configuration path, inclusion path are set correctly in the referenced programs

  • Share/Save/Bookmark
Aug
15
2009

Permission denied: exec of failed in Apache Server

Apache Permission Denied Error can be caused due to one of many configuration mistakes listed below

Check the apache configuration settings

i) The first is the reference to folder where cgi or perl files will reside and its execute permission settings

 <ScriptAlias /cgi-bin/ /usr/local/cgi-bin/>
 <Directory "/usr/local/cgi-bin">
     AllowOverride None
     Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
     Order allow,deny
     Allow from all
 </Directory>

ii) The second is the proper add handlers that are set for the file execution

AddHandler cgi-script .cgi .pl
<Files ~ "\.pl$">
    Options +ExecCGI
</Files>
<Files ~ "\.cgi$">
   Options +ExecCGI
</Files>

Check the apache error log for any messages (/var/log/apache2/error.log).

  • Share/Save/Bookmark
Aug
08
2009

How to hide Apache version, Modules loaded, PHP Version?

It is often advisable not to disclose information than is necessary when web request are made to Apache server.

By default, Apache displays the version of the server, modules loaded in the server and the version of PHP if PHP is configured with Apache.

In httpd.conf file, set the following directives.

ServerSignature Off
ServerTokens ProductOnly

By default, ServerSignature is set to Off and ServerTokens is set to Full in most Linux distros.

  • Share/Save/Bookmark
Aug
07
2009

How to find the version of Apache?

In ubuntu, it is

$ apache2 -v

In CentOS, it is

$ httpd -v

To find out where apache2 or httpd program is installed you can do the
$ whereis apache2 or,
$ locate httpd

  • Share/Save/Bookmark
Aug
05
2009

Ubuntu Hardy Heron, CakePHP Setting in Virtual Host Environment

If you are to setup CakePHP in a virtual hosting environment, we need to ensure that the DocumentRoot is setup correctly. Based on the experience I have had I thought to list down the virtual host setting and cakephp .htaccess setting files.

root@myserver:/etc/apache2/conf.d# cat vhosts.conf
NameVirtualHost 192.168.1.100:80

<VirtualHost 192.168.1.100:80>
ServerName cakeapp
DocumentRoot /var/www/cakeapp
</VirtualHost>

(Note that there is no ending forward slash after /var/www/cakeapp. If there had been one, it might cause a problem if the /var/www/cakeapp/app/config/routes.php is not configured correctly indicating a never ending loop in resolving domain name)

root@myserver:/etc/apache2/conf.d# cat /var/www/cakeapp/.htaccess
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>

  • Share/Save/Bookmark
Aug
04
2009

Ubuntu, Apache: Virtual Hosting

Virtual Hosting in Ubuntu Hardy Heron: Case Example

Consider the case of two domain names mysite1 and site2 to be served on IP Address 192.168.1.100 (port 80)

Before proceeding let us look at how resolv.conf and hosts file are set up …

$ cat /etc/resolv.conf
search kurinchilion.com
nameserver 192.168.1.100

$ cat /etc/hosts
127.0.0.1 localhost
192.168.1.100 myserver.kurinchilion.com myserver

# The following lines are desirable for IPv6 capable hosts
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

(more…)

  • Share/Save/Bookmark
Aug
03
2009

Apache, Ubuntu, CentOS: Virtual Host Configuration

What is Virtual Hosting?

Virtual Hosting is a technique by which web servers can serve more than one domain name on the same server. It can also be a variation of serving different sites on the same IP but on different ports.
(more…)

  • Share/Save/Bookmark