Tag: cgi

Running CGI script from any directory or via /~username/cgi-bin

by admin on Sep.07, 2009, under DirectAdmin

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 this text into the file:

Options +ExecCGI
AddHandler cgi-script .cgi .pl

Leave a Comment :, , , more...

cgi files generate Internal Server Error

by admin on Sep.07, 2009, under DirectAdmin

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. The file needs to be in a cgi-bin and must have the owner/group as the username who owns the site. If it’s owned by anyone else, it will not run. Also, the script must have execute permission. The most common chmod permission is 755. Go through all directories from the public_html down to the directory the script is in, and make sure they’re all set to 755 (public_html can be 750 *only* if it has a group of apache).
If the suexec_log only shows the script being run, then the cause may be with the script code itself. The easiest way to figure out script coding problems is to first run the script manually from an ssh prompt.

cd /home/username/domains/domain.com/public_html/cgi-bin
./script.cgi

One common error is to use an incorrect interpreter. The 2 most common interpreters are:

#!/usr/bin/perl

and

#!/usr/local/bin/php

This code must appear on the first line of the script. Sometimes a file is uploaded in windows format so the trailing newline (return) character is formed incorrectly and the file would need to be re uploaded in a different format.
Other errors that would be generated when running the script manually from ssh would be missing perl modules, in which case you’ll need to install them yourself. Cpan is the easiest method to install new perl modules, e.g.:

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

Leave a Comment :, , , , , more...

Using a custom VirtualHost template

by admin on Sep.07, 2009, under 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). Note that there are actually 8 virtual_host files, but you only need to worry about the 4 that apply to you. The files with the 2 in them are for apache 2.x. The ones without the 2 in them are for apache 1.3.
Inside the virtual_host*.conf files, you’ll find code that is similar to httpd.conf code, but contains what are known as tokens. These tokens are what will be replaces with specific user data for each domain created.

Available tokens

DOMAIN
the name of the domain. eg: domain.com

IP
the IP address associated with that domain. eg: 192.168.3.4

HOME
The users home directory. eg: /home/gary

ADMIN
The email address of the server admin. webmaster@domain.com

HOSTNAME
The hostname of the server. eg: server.domain.com

SAFE_MODE
ON or OFF if php safe_mode is enabled or not

PHP
ON or OFF if php is enabled or not

CGI
The whole httpd.conf line used to add the Script-Alias

HANDLERS
httpd.conf code holding all apache handlers

MIMETYPE
httpd.conf code holding all apache mime types

USER
the username

GROUP
the users group name (99% of the time, it’s the same as the USER)

DOCROOT
The DocumentRoot of the VirtualHost. This is the path that apache will use to access the data when the ServerName (domain.com) is requested

SUB
for the virtual_host_*sub.conf file, the subdomain name. eg: sub

CUSTOM
custom httpd.conf code to be inserted if the domain.com.cust_httpd file exists. (See Adding custom httpd.conf code the VirtualHost of one domain)

CAROOT
The whole httpd.conf line used to load in the SSLCACertificateFile directive

CERT
The path of the certificate to be used for the domain

KEY
The path of the certificate to be used for the domain

The top of the templates should contain |?CGI=…| and |?DOCROOT=…|. These lines are where the data for the CGI and DOCROOT tokens are set. If cgi is not enabled, this line wil be ignored and the CGI token will be empty. If the domain is suspended, the DOCROOT will be filled the the path of the suspend page. The CAROOT token will be empty unless the User has added a valid CARootCertificate through DA.
You can use tokens when assigning a value to CGI or DOCROOT, just use `TOKEN` instead of |TOKEN|.
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.
Note, that you can also use if-then-else statements if you don’t want all settings to be global. Example, say you want a custom item added, only for 1 domain:

|*if DOMAIN="domain.com"|
#custom item for just this domain
|*endif|

See the if-then-else link for more info on what else you can do with this basic scripting tool.
You can also run actual scripts with database queries, etc… if you wanted using the script portion of the templates.
More info on that here: http://www.directadmin.com/features.php?id=756

Leave a Comment :, , , , , more...

LXAdmin Administrator Tutorial

by admin on Feb.16, 2009, under Tutorial

1. INTRODUCTION

1a. Introduction

LXadmin “Host in a box” is the only control panel that makes use of Lighttpd and DJBDNS which only uses 8 MB of RAM with a freshly installed system. The control panel itself uses 1 MB of RAM when idle. LXadmin “Host in a box” is part of LXadmin, the leading light-weight control panel in the industry. The only difference between the two is the use of different daemons.

This lightweight control panel has all of the features included in all leading control panels such as mail, spam filter, PHP, CGI, Perl, SUexec, FTP, MySQL and much much more. You will get to find out more in this document as you read.


2. THE BASICS

2a. Accessing the control panel

There are several ways to access LXadmin:

http://yourdomain:7778 – You can access the control panel through any hosted domain by putting :7778 at the end of the domain.

https://yourdomain:7777 - You can access the control panel securly using SSL through any hosted domain by putting :7777 at the end of the domain.

http://192.168.0.1:7778 or https://192.168.0.1:7777 - You can access the control panel through any IP address allocated to the server.  This is useful when your domain transfer has not yet propagated.

A window (top right image) will appear.  Enter your username and password and you should have successfully logged in.

login

2b. Changing your password

2b
To change your password, click client home and then on the top right corner, you will see the password tab. Click on it and fill in your existing password and the new password twice and click Update.

2c. Adding a DNS Template

You have to add a DNS template initially. DNS template is the DNS configuration which will be copied to your domain’s DNS when a new domain is created. For adding a DNS template, you have to basically specify the primary and secondary nameservers for the domains you are planning to create on this server. For instance: ns1.lxlabs.com and ns2.lxlabs.com . The name is simply an identifier which will be used later when creating the domain.

For creating a new DNS template,

go to “Client Home” page and under “Domains“, click the “DNS Templates” icon

In the DNS Templates page, you can see the list of existing DNS templates. If you do not have any existing DNS template, create a new DNS template by clicking the “Add DNS Template” tab on the top.

In the next page, enter the DNS information for the template:

Click the “Add” button and the new DNS template is created. You can see the new DNS template in the list of DNS Templates

Click on the new DNS Template name to edit DNS records like NS, A, CNAME, MX and TXT

2d. Add a Reseller

Before you proceed to add a new Reseller, you have to add a new plan for the new client/reseller
To add a new plan,

To add a new plan, click “Client Plans” icon

In the next page, click the “Add Client Plan” tab.

Here you can enter the plan details like:

Client Plan name)
Description of the plan
Number Of Clients allowed
Number Of Domains allowed
Disk Usage (in MB)
Number Of Subdomains allowed
Mail Disk Usage (in MB) limit
Number Of Autoresponders allowed
Number of Mail Accounts allowed
Number Of Mailing Lists allowed
Traffic (in MB per Month) limit
Maximum number of MySQL Databases
Maximum Number Of Domain Users
Ability to add more domains
Ability to set Disabled URL
Ability to Enable Ssl
Ability to Enable Statistics
Ability to Enable Cgi
Ability to Enable Php
Ability to Enable Asp.net (ignored On Linux)
Allow Scheduler Management or not
Allow Backup Scheduling or not
Allow Backing Up or not
Can Manage DNS or not

Once you have created the plan, go back to the “Client Home” page and click the “Clients” button link

This page will list your existing customers and resellers. If you do not have any, click on either the “Add Reseller” tab that you see on the top.

In the “Add Reseller” page, enter a name for your Reseller, password and email address.
If you enable the “Send Welcome Message” check box, an email with the account details will be sent automatically to the Reseller’s email address.
Select the plan you have created earlier and click “Add” button.

Now in the “Clients” page, you should be able to see the new Reseller that you have created:


Leave a Comment :, , , , , , , , , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Kontak

Budhi Indah A 31
Cimindi Cimahi 40514
West Java
Indonesia

Phone/SMS :
Info/Bantuan : 62-8158-6270622
Billing/konfirmasi : 62-8888-763551

Self Advertise


My site is worth $7548.2.
How much is yours worth?