1. Please take a little time for this simple survey! Thank you for participating!
    Dismiss Notice
  2. Dear Pleskians, please read this carefully! New attachments and other rules Thank you!
    Dismiss Notice

Preview domains over IP without DNS-entry

Discussion in 'Plesk for Linux - 8.x and Older' started by Oldperl, Jul 28, 2005.

  1. Oldperl

    Oldperl Guest

    Greetz from germany @all and please excuse my bad english :rolleyes:

    the problem: I'm installing several domains in Plesk 7.5.x and wanted a kind of preview for my customers, so they only have to type something like http://xx.xx.xxx.xx/domain.tld/ into browser. I searched the forum for hours and also the manuals, but no solution.

    the goal: just to change one thing and then it has to work for all.

    the solution:
    1. I set one domain as default. http://forum.sw-soft.com/showthread.php?threadid=25683

    2. I wrote a vhost.conf file for that, and only for that domain.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    ^(/(.)+\.de)$ $1/ [R]
    RewriteRule ^(/(.)+\.de)(/.*) /home/httpd/vhosts$1/httpdocs$3
    # looks for domain.tld (here .de)behind IP and points to the right directory
    ad:stupid forum, it has stolen a backslash in code :mad:
    so here the code without PHP-quote. Hope that works. Btw, must be a bug of forumsoftware, because the parser also don't recognize \\, normaly that works in PHP, oh well :rolleyes:

    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^(/(.)+\.de)$ $1/ [R]
    RewriteRule ^(/(.)+\.de)(/.*) /home/httpd/vhosts$1/httpdocs$3
    # looks for domain.tld (here .de)behind IP and points to the right directory

    The first Rewriterule checks for the / at the end, so you can write http://xx.xx.xxx.xx/domain.de or http://xx.xx.xxx.xx/domain.de/
    The second rule takes all behind http://xx.xx.xxx.xx and also check for .de in that string. Normaly you don't have directorys like MyDomain.de
    hint: if you want to use this for other .tld's just copy the to rules and change .de to what ever you want ;)

    3. I put the vhost.conf file in the /conf directory of the default domain and installed it ==> http://download1.sw-soft.com/Plesk/Plesk7/Doc/html/plesk-7-advanced-features/ch06.html

    4. Now i restarted the apache server and then tried to reach my second domain http://xx.xx.xxx.xx/domain2.de
    It works fine. Now i can start to setup my other domains, testing them and at least register them, without changing something in setup of new domains.

    Hope that will save your time ;)


  2. Oldperl

    Oldperl Guest

    Hello again :)

    Now i have a problem again :rolleyes:
    The workaround above works fine if u just have a html-based Site, but now i tried to start a php file in my second domain.
    IE starts the file for download and don't parse it, hmm

    I think the problem is that my virtuell host directives are only for domain1 and there is nothing in it for domain2. in any kind i have to tell apache/php to parse the php-file for domain2 also.

    ANybody here who can tell me how i do that please.
    I need to tell apache to parse domain2 php-files called over domain1. Maybe there is something else missing in my vhost.conf.
    Searched for the last 5 hours the web but can't find anything working.


  3. jamesyeeoc

    jamesyeeoc Guest

    Personally I think it is much easier to just set your workstation's primary DNS server to be your Plesk server. That way all DNS requests go to your Plesk server first, which will be able to give the proper IP for the domain.

    This allows you to use the domain before making registrar level changes to the domain's nameserver settings. Has no effect on an existing 'live' domain located elsewhere on another server.

    Reconfiguring either Windows or Linux workstations to use a different DNS server for lookups is really simple in any case, not even requiring a reboot (except Win9x).
  4. sieb@

    sieb@ Guest

    Of, you could just set the IP staticly in your hosts file on your workstation. I do it all the time to test domains.
  5. jamesyeeoc

    jamesyeeoc Guest

    True, but I find it easier to set the primary to a plesk server that i'm working on (especially when working with multiple domains), and set the secondary to the ISP's DNS. As long as the Plesk server has the /etc/resolv.conf setup it should pass DNS requests upstream in any case.

    For me, this works better than changing a dozen or more domain entries in the HOSTS file. And then some people (actual posts) also forget they have the HOSTS entries and wonder why the domain doesn't resolve properly when they switch hosts :D
  6. rblckfrd

    rblckfrd Guest

    but client preview purposes...

    I have been following this post as I am need of the same solution... pointing your workstation DNS to your own nameservers is great for internal development, but we need our clients to also view the site, and telling them how to change their workstation DNS settings back and forth would be a nightmare!

    It's also unwieldy to send out the https address that Plesk generates for Site Preview.

    Additionaly, we are installing a suite of PHP scripts at each site, so an Apache mod_rewrite rule would be really keen, allowing us to view the site pre-DNS propagation without editing all the paths in the php config scripts.

    I am sure an Apache expert out there could write a var.conf file like this while sleeping!
  7. jamesyeeoc

    jamesyeeoc Guest

    See this other post, originally rewrites for secure https:, but you can remove that part and with very little tweaking, see if it will work for your situation. Basically it's using Apache's built-in 'internal proxy' rewrites, which would probably work in your situations as well.