How to Fix Internal Server Error for cgi script.
Internal Server Error for cgi script means that the cgi script did not execute properly.
1) check the /var/log/httpd/suexec_log. It contains any errors that would be as a result of not having correct permissions on the file.
2)The file needs to be in a cgi-bin and must have the owner/group as the username who owns the site.
3)The most common chmod permission is 755, the script must have execute permission.
4)The easiest way to figure out script coding problems is to first run the script manually from an ssh prompt.
5)Other errors that would be generated when running the script manually from ssh would be missing perl modules.
6)Cpan is the easiest method to install new perl modules.
DirectAdmin Installation
Control panel for web hosting companies running Red Hat 7.x, 8.x, 9.x, Red Hat Enterprise and FreeBSD.
Requirements
- Clean OS install
- At least one external IP address (NAT/LAN-based systems will NOT work)
- SSH installed, gcc and g++ installed
- Client account at https://www.directadmin.com/clients
Installation!
You *have* to add “AllowUsers username” to /etc/ssh/sshd_config before you log out from root or you’ll lose root on the server forever, and you’ll have to format.
Login as root and download the setup.sh file
# wget http://www.directadmin.com/setup.sh
Use “fetch” instead of “wget” on FreeBSD systems.
Change permissions on the setup.sh file
Run the setup script!
You will be prompted for a client ID number, license ID number, and hostname.
Important: The hostname should not be the same as the primary domain name. e.g. example.com is not a good hostname, where server.example.com is. Having the same host/main domain name will cause e-mail and FTP problems. Also, please make sure the hostname resolves once you setup DNS.
What is mod_security or modsecurity?
ModSecurity is an open source intrusion detection and prevention engine for web applications. It operates embedded into the web server, acting as a powerful umbrella - shielding applications from attacks. ModSecurity supports both branches of the Apache web server.
This HOW-TO is for Apache 2.X only.
-
cd /usr/local/src
-
mkdir modsecurity2
-
cd modsecurity2
-
wget http://www.serverbuddies.com/files/modsecurity-apache_2.5.9.tar.gz
-
perl -pi -e ’s/ServerTokens Major/ServerTokens Full/’ /etc/httpd/conf/extra/httpd-default.conf
-
perl -pi -e ’s/ServerSignature Off/ServerSignature On/’ /etc/httpd/conf/extra/httpd-default.conf
-
perl -pi -e ’s/ServerSignature EMail/ServerSignature On/’ /etc/httpd/conf/extra/httpd-default.conf
-
tar xzf modsecurity-apache_2.5.9.tar.gz
-
cd modsecurity-apache_2.5.9
-
cd apache2
-
./configure
-
make
-
make test
-
make install
Now we download a pre-defined mod_sec ruleset,
-
cd /etc/modsecurity2/
-
wget http://www.serverbuddies.com/files/modsec.v2.rules.conf
Add the new compiled mod_security module into the apache configuration,
-
vi /etc/httpd/conf/httpd.conf
After:
LoadModule php5_module /usr/lib/apache/libphp5.so
Add:
For 32bit -
-
LoadFile /usr/lib/libxml2.so
-
LoadModule security2_module /usr/lib/apache/mod_security2.so
For 64bit -
-
LoadFile /usr/lib64/libxml2.so
-
LoadModule security2_module /usr/lib/apache/mod_security2.so
At the botton of the httpd.conf config file we add the following,
-
<IfModule mod_security2.c>
-
# ModSecurity2 config file.
-
#
-
Include /etc/modsecurity2/modsec.v2.rules.conf
-
</IfModule>
Restart the webserver.
Installation should be completed and mod_sec should be now loaded on your Apache webserver.