Help - Search - Members - Calendar
Full Version: how to set up subdomains on a plesk server - same as 4 RAQ, i guess.
The Planet Forums > Control Panels > Plesk
nat
It would be nice if members could setup an unlimited # of subdomains by themselves, but it appears that you can't do this unless each domain has its own ip. Or unless your smart and know what your doing UNlike me. Here's a script that allows members to setup subdomains but each domain must have its own ip: http://forum.plesk.com/showthread.php?s=&t...ight=subdomains


Subdomain = sub.domain.com shows default page located in www.domain.com/sub/

Plesk shouldn't count subdomains as real domains Unless you want it setup as a real domain with its own space and features.

Here's how I setup subdomains without plesk counting it as an additional domain (i think) and it seems to work.

This is for PSA RPM install.
psa v2.0.1_build011129.18 os_RedHat 7.1
Assumes the ip used for name based domain is: 65.64.21.20
This is the same as what is mentioned in the RAQ forums.

login via ssh2

# cd /etc/httpd/conf
# cp -a httpd.conf httpd.conf.bak
# pico httpd.conf

added this line at bottom of httpd.conf:

Include conf/virtualips.conf

- Control X, and saved file.

# pico virtualips.conf

Added this in virtualips.conf for a subdomain:


ServerName sub.domain.com
ServerAlias sub.domain.com
DocumentRoot /home/httpd/vhosts/domain.com/httpdocs/sub
CustomLog /home/httpd/vhosts/domain.com/logs/access_log combined
ErrorLog /home/httpd/vhosts/domain.com/logs/error_log


- Control X, and saved file.

# /usr/local/psa/admin/sbin/my_apci_rst

Login to PSA as admin.

Click "Domains"

Click "domain.com"

Click "DNS"

Select "Record type:" A

Click "Add"

In 1st field enter: sub

In 2nd filed enter the ip address of the server: 65.64.21.20

Click "Update"



Subdomain: sub.domain.com now ready to use.

To add additional subdomains just add additonal entries in the virtualips.conf file and add a A record entry for the domain in plesk. cname seems to work too.

You can add additional stuff in virtualips.conf file to get cgi and stuff working for the subdomain.

It should only take about 5 minutes to setup. $5 setup each after 10 free subdomains sounds good for me. icon_biggrin.gif
nat
To allow members to setup an unlimited number of subdomains:

1) how about adding a wildcard A record automatically for all domains that are setup in plesk. Easily done.

2) then make a perl script that will allow members to add the part in a "virtrualip.txt" file which will be saved within their .....vhost/domain.com/ directory. This will be automated for the users so they only have to enter in the subdomain name and directory it will point to.

Add the perl script to the skel directory so that it is added automaticly everytime a domain is setup.

3) make another script that will check all domains directories for this file and when it finds one it will add the information in it to the virtualips.conf file. This script could be execute by a cron job every night. The script could also check for people adding things they should NOT add in the virtualips.txt file before it adds the info to the virtualips.conf file.

4) make a cron job that will pickup the info in the virtualips.txt file every night and also restart Apache.

I'm too dumb for this. Seems like it could be done very easily for people that know perl. Of course maybe it wouldn't be that easy.



This would allow members to setup an unlimited number of subdomains without bothering me. (i think)

If you don't want some of your members to have unlimited subdomain support, you can just take out the wildcard entry in the dns until they pay for the upgrade. icon_biggrin.gif

...just an idea
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2009 Invision Power Services, Inc.