Archive for December, 2009

SBDavid

Running CGI script from any directory

Running CGI script from any directory

In order to force apache to allow cgi script to run, simply create a file called .htaccess inside the directory in which you wish to run the scripts. Insert the following text into the .htaccess file:

Options +ExecCGI
AddHandler cgi-script .cgi .pl
SBDavid

Internal Server Error with cgi files

Internal Server Error with cgi files

This means that the cgi script did not execute properly. There are several causes that can generate this error so a few things would need to be checked.

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 script must have execute permission.

4) The most common chmod permission is 755.

5) The easiest way to figure out script coding problems is to first run the script manually from an ssh prompt.

6) Other errors that would be generated when running the script manually from ssh would be missing perl modules.

7) Cpan is the easiest method to install new perl modules, eg:

perl -e shell -MCPAN
install Bundle::DBD::mysql

How to modify the open_basedir setting for one domain in DirectAdmin

To change the open_basedir value when using php in CLI mode (not suPHP), you can do so by going to:

Admin Level -> Custom httpd configuration -> domain.com

In the top text area, insert this one line:

|?OPEN_BASEDIR_PATH=`HOME`/:/tmp:/usr/local/lib/php/|

which is the default value in the templates. Edit the paths in that line to meet your needs.

Source : http://directadmin.com/

DirectAdmin custom httpd.conf code to the VirtualHosts of a domain

DirectAdmin Allows Admin to insert extra httpd.conf code that a User may require. To access the control page for this functionality, go to Admin Panel -> Admin Settings -> Customize Httpd Configurations.

Once you see the list of domain, click the domain you wish to insert the extra httpd.conf code to.

Another common use is to add another ServerAlias. This allows another domain to be used to access the exact same content. To accomplish this, you would write

ServerAlias mynew-domain.com www.mynew-domain.com

To get mynew-domain.com and www.mynew-domain.com to point to the original domain for the VirtualHost. You will also have to make sure that mynew-domain.com and www.mynew-domain.com both resolve to the same IP.

Using a custom VirtualHost template in DirectAdmin

If you wish to change the setup of the VirtualHosts for all domains, you can do so by creating your own custom templates.

cd /usr/local/directadmin/data/templates
cp virtual_host*.conf custom
cd custom

Once you’ve copied the 4 VirtualHost files (or just the ones you want) to the custom directory, you can then edit the new files you’ve just copied. DirectAdmin will always check for the custom file before going to the default ones. Failure to copy the virtual_host*.conf files to the custom directory before modifying them will result in a loss of all changes when DirectAdmin updates itself (the files are overwritten).

Once you are happy with your new virtual_host*.conf files they’ll need to be used in the real httpd.conf files. You can trigger DirectAdmin to rewrite all User httpd.conf files by running:

echo “action=rewrite&value=httpd” >> /usr/local/directadmin/data/task.queue

The command will be added the the task queue which is checked once per minute, so it may be a few minutes before all httpd.conf files have been rewritten. *Note: the main /etc/httpd/conf/httpd.conf is never overwritten (unless DirectAdmin is reinstalled) so any changes you make will be safe.

Source: http://directadmin.com/

« Prev - Next »