Community Forums
Connect with us on LinkedIn
+ Reply to Thread
Results 1 to 12 of 12
  1. #1
    Member
    Join Date
    Jun 2008
    Posts
    221

    Default mod_userdir or Not?

    Hi,

    We run with mod_userdir to prevent bandwidth stealing.

    However, new users want to access their website immediately, even while waiting for the domain to propagate.

    Is there a solution? Is there a way to allow this without just turning mod_userdir completely off?

    Thanks and best regards,

    Mark

  2. #2
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: mod_userdir or Not?

    Hello Mark,

    Actually, if you were using mod_userdir, then it would allow the temporary url, so you would mean you have mod_userdir disabled (you have enabled the tweak to disallow it).

    There are two available options if you are going to disallow using mod_userdir for sites:

    1) On account or domain creation, email the account user to mention using the hosts file to temporarily set the domain to point to the machine to see it:

    Hosts (file) - Wikipedia, the free encyclopedia

    2) Create a subdomain of the server's main domain for every new account such as subdomain1.myserver.com, subdomain2.myserver.com

    Creating a subdomain could be done using a script in /scripts/postwwwacct hook that will create such a subdomain for you. Since you would already control the main domain on the machine (the one you have associated with the server's hostname), you could add subdomains onto it and have those work. The subdomain would then be usable until they change their domain to point to the machine.

    To see details on postwwwacct hook script, please review ScriptHooks < AllDocumentation < TWiki

    Thanks!
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  3. #3
    Member
    Join Date
    Jun 2008
    Posts
    221

    Default Re: mod_userdir or Not?

    Actually, if you were using mod_userdir, then it would allow the temporary url, so you would mean you have mod_userdir disabled (you have enabled the tweak to disallow it).
    Yep, that's what I meant.

    1) On account or domain creation, email the account user to mention using the hosts file to temporarily set the domain to point to the machine to see it:
    Good idea, but I think it would be over some users' heads.

    2) Create a subdomain of the server's main domain for every new account such as subdomain1.myserver.com, subdomain2.myserver.com

    Creating a subdomain could be done using a script in /scripts/postwwwacct hook that will create such a subdomain for you.
    Sounds like a plan. I've not had much luck with postwwwacct syntax. Can you (or anyone) point me to some snippets of code that might help?

    Thanks!

  4. #4
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: mod_userdir or Not?

    Sounds like a plan. I've not had much luck with postwwwacct syntax. Can you (or anyone) point me to some snippets of code that might help?
    You might want to head over to our developers area to ask this question:

    cPanel Developers
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  5. #5
    Member
    Join Date
    Jun 2008
    Posts
    221

    Default Re: mod_userdir or Not?

    I've been looking at the subdomain idea (not just automating it, but trying to set it up manually to test first). I'm not sure I grasp how to do it.

    The suggestion is to create a subdomain under the main domain.

    So, if user creates cPanel account for userdomain.com, we would create a subdomain, e.g., userdomain.maindomain.com, under which they would access their site without mod_userdir.

    My question is how we create that subdomain...what kind of record, and where does it point? If the user doesn't have a static IP, we can't just create an A record. If we do a CNAME pointing to the user's domain, that's a problem because the whole issue here is waiting for the domain to propagate.

    Any ideas?

    Thanks,

    Mark

  6. #6
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: mod_userdir or Not?

    Yes, maindomain.com represents the main domain of the server itself, the one that is being used by the hostname. Typically, you have server.mymaindomain.com on a machine and mymaindomain.com is under your control. You'd have that main domain using DNS on your server. Since you control it, you can create subdomains on it for these accounts for users to have working as a placement until their actual domain propagates to your server. The suggestion isn't to add a subdomain on the user's domain, but a subdomain on your server's main domain.
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  7. #7
    Member
    Join Date
    Jun 2008
    Posts
    221

    Default Re: mod_userdir or Not?

    Thanks. I understand the gist...we'd create a subdomain under our main domain (that's under our control), and that would point to the customer's site so they could access their site during propagation.

    Two followup questions:

    1) What method do you recommend to point that subdomain to the new client site? I don't think an A record would work unless the client has a static IP, right? (And, due to IP allocation issues, few of our clients' sites will have static IPs.) I mean, if we just point it at the main shared IP, that server wouldn't necessarily know how to route the traffic to that site. Or would it be a CNAME or another method?

    2) How could we automate this creation? I know it would be a postwwwacct situation, but I've never seen enough of an explanation of the syntax to know how we might set up the directive to do this. Any help (pointing in the right direction) will be appreciated.

    Thanks,

    Mark

  8. #8
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: mod_userdir or Not?

    All shared sites under the shared IP route using httpd.conf to determine which host is served. You would use the A record IP of the shared IP for that account if they are on the shared IP. You can test it out yourself to see the results. Create a new account in WHM > Create a New Account using a subdomain off your main domain. The site will route to the new location because httpd.conf will be able to know when you hit that subdomain it should go to /home/username/public_html spot for that subdomain.

    As for automation, I already suggested posting in the developers area earlier. This is a developer question. Please post it there:

    cPanel Developers
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  9. #9
    Member
    Join Date
    Jun 2008
    Posts
    221

    Default Re: mod_userdir or Not?

    Hi,

    Okay, it's getting clearer now but I'm still confused about a little of the process:

    Create a new account in WHM > Create a New Account using a subdomain off your main domain. The site will route to the new location because httpd.conf will be able to know when you hit that subdomain it should go to /home/username/public_html spot for that subdomain.
    So the new account would be created as a subdomain (off the main domain), not a domain? If so, that eliminates the need to do the post subdomain creation, if it's done during the account creation.

    The questions:

    - How can we have cPanel set up a new account as a subdomain? (These will be automated signups via WHMCS.)
    - What if the user is registering a domain, or pointing a domain to their site? How do we accommodate that, in a way that doesn't complicate things for the user?

    Thanks,

    Mark

  10. #10
    Member
    Join Date
    Jun 2008
    Posts
    221

    Default Re: mod_userdir or Not?

    One other questionL

    Create a new account in WHM > Create a New Account using a subdomain off your main domain. The site will route to the new location because httpd.conf will be able to know when you hit that subdomain it should go to /home/username/public_html spot for that subdomain.
    How will this be done with multiple servers? For example, we have:

    host1.ourdomain.com
    host2.ourdomain.com
    host3.ourdomain.com

    ...etc.

    So, if a new client is created on host2 (for example), I'm not sure how this would all be handled correctly. Or will it kind of happen automatically, because the subdomain will be assigned to a certain subdirectory on the IP address of host2?

    I hope I've explained what I'm wondering about.
    Last edited by markb14391; 02-06-2012 at 02:35 PM.

  11. #11
    cPanel Staff cPanelTristan's Avatar
    Join Date
    Oct 2010
    Location
    somewhere over the rainbow
    Posts
    6,305
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: mod_userdir or Not?

    Hi Mark,

    Please do post these into the developer's area, since I wouldn't know how to automate using the API for what you are asking:

    - How can we have cPanel set up a new account as a subdomain? (These will be automated signups via WHMCS.)
    - What if the user is registering a domain, or pointing a domain to their site? How do we accommodate that, in a way that doesn't complicate things for the user?
    For the user signing up, you could have them sign up using their domain and either place that domain as a parked domain on the account or have it the primary domain and the subdomain as a parked domain. A parked domain would point to the same document root. Your automation tools will need to account for the process, and that's where using the API would come into play.

    For the second questions on using the same main domain on multiple machines, the A record IP will determine which machine has the subdomain off the main domain. Think of it this way, host1.ourdomain.com is pointed to a specific machine using the IP address for the A record. The hostname is simply a subdomain off ourdomain.com, which is exactly the same as what you'd be doing for these user subdomains. You can put them onto any machine in the cluster of servers so long as the A record is pointing to the correct machine where the site will belong.

    Hope that clarifies things for you.

    Thanks!
    cPResources: Support Options | More Support Options | Forums Search | cPanel.net Site Search | Mailing Lists(Alt) | Docs
    -- Tristan, Forums Technical Analyst, cPanel Tech Support

    Submit a ticket | Check an existing ticket

  12. #12
    Member
    Join Date
    May 2011
    Posts
    238
    cPanel/Enkompass Access Level

    Root Administrator

    Default Re: mod_userdir or Not?

    Quote Originally Posted by markb14391 View Post
    Hi,

    We run with mod_userdir to prevent bandwidth stealing.

    However, new users want to access their website immediately, even while waiting for the domain to propagate.

    Is there a solution? Is there a way to allow this without just turning mod_userdir completely off?
    I guess you may have seen this, but incase you haven't, then FYI you can allow only the new user to access his site through the temporary url.

    Apache mod_userdir Tweak

    You can allow specified users to access their websites via mod_userdir. For example, resellers can use this feature to allow their customers to access their own websites before DNS information has propagated. To enable mod_userdir access for a specific user:
    • Click the Enable mod_userdir Protection checkbox at the top of the page.
    • Determine the virtual host(s) through which the user can access his or her site via mod_userdir. Most likely, this will be the default virtual host, or their reseller's virtual host.
    • If you select the virtual host for the user's primary domain, mod_userdir will not function until the DNS is pointing the domain towards the server.
    • Enter the user who should have access via mod_userdir in the appropriate Additional Users field.
    • Click the Save button at the bottom of the page.

    Note: Do not click the Exclude Protection checkbox if you wish to allow an individual user to access his or her site via a mod_userdir URL.
    Wouldn't this be easier?

    Hope this is what you meant.

Similar Threads & Tags
Similar threads

  1. mod_userdir
    By HH-Mike in forum cPanel and WHM Discussions
    Replies: 10
    Last Post: 01-05-2009, 06:00 PM
  2. Question about mod_userdir
    By cyndre2 in forum Security
    Replies: 2
    Last Post: 09-16-2008, 01:43 PM
  3. Question about mod_userdir
    By cyndre2 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 09-16-2008, 01:23 PM
  4. mod_userdir problem
    By felosi in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 09-26-2007, 12:03 AM
  5. mod_userdir Protection
    By maxihost2 in forum cPanel and WHM Discussions
    Replies: 2
    Last Post: 08-14-2005, 01:05 PM
Linkedin       Facebook       Twitter       RSS       Flickr       YouTube