Results 1 to 6 of 6
  1. #1
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    If your like me your using your development server to test, develop and maintain dozens of sites and projects. If your doing it using only one document root that can be a pain in the butt. There's a better way.

    First, you need a relativily static IP address for your server. I wouldn't recommend this for dial-up users but you can always give it a try. Second you need a domain name or at least a subdomain name to point at your server's relativily static IP . This just require you make an 'A' record that points to your servers IP address. Lastly you need to activate vhosting.

    To do that with an Apache server you need to add the following to your httpd.conf file with the appropriate changes:

    <pre class="ip-ubbcode-code-pre">
    #
    # Turn on name-based virtual hosting
    #
    NameVirtualHost *

    # no different from setting up httpd.conf
    &lt;VirtualHost *&gt;
    # this is used on error pages
    ServerAdmin webmaster@devserver.mydomain.com
    # point this to your new document root you'll be accessing
    # with this domain or subdomain
    DocumentRoot "C:/server/www/htdocs/bogus/mydomain_com/site/new_structure"
    # set this to the domain or subdomain your using
    ServerName devserver.mydomain.com
    # just copy ErrorLog & CustomLog from your orginal setup
    # unless your expecting visitors and want a seperate log
    # in that case don't forget to create the subdirectories and files needed
    ErrorLog logs/error.log
    CustomLog logs/access.log common
    # you can put any other directives you want to use for this vhost in here
    ErrorDocument 401 /401.php
    &lt;/VirtualHost&gt;

    # What about my other sites?
    # ah .. that's where this next little bit comes in
    # this allows you to access everything else just the way you use too
    # through localhost or 127.0.0.1
    &lt;VirtualHost 127.0.0.1:*&gt;
    # the original DocumentRoot, ErrorLog and CustomLog
    DocumentRoot "C:/server/www/htdocs"
    ServerName localhost
    ErrorLog logs/error.log
    CustomLog logs/access.log common
    &lt;/VirtualHost&gt;</pre>

    Now you can expand this in one of two way:

    Create more domains/subdomains and vhost entries (Good for truely Static IP's) every domain could have a subdomain pointing back to the development server.

    or

    setup some scripts to modify your vhost entry for your various projects/sites and restart Apache. (I use this method I'm not truely static)

    Hope this gave you some ideas of how you can improve your development server use.

    Now crossing my finger and hitting post. Hope all those little triangels don't disappear.

    ------------------------------
    "If all the newbies are going to start writing ebooks maybe I should get started on mine!" -- Buddha

  2. #2
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    Just another quick tip for those who might try this. To direct everyone who surfs in on your IP to an nice safe "go away your not welcome page" add the following as the first VirtualHost entry:

    <pre class="ip-ubbcode-code-pre">&lt;VirtualHost *&gt;
    # point to a safe area
    # with "go away" page
    # which should an index file
    DocumentRoot "C:/server/www/htdocs"
    ServerName localhost
    ErrorLog logs/error.log
    CustomLog logs/access.log common
    # change this to your index file
    # so no matter what they were looking for
    # all they get is the "go away" message
    ErrorDocument 404 /index.html
    &lt;/VirtualHost&gt;
    </pre>

    Happy Coding!

    ------------------------------
    "If all the newbies are going to start writing ebooks maybe I should get started on mine!" -- Buddha

  3. #3
    Full Member jollygoodpirate's Avatar
    Join Date
    January 18th, 2005
    Location
    NC
    Posts
    227
    For developing sites, here is how I do it. Put each site in its own port...

    http://192.168.1.100:8181/
    http://192.168.1.100:8182/
    http://192.168.1.100:8183/

    Then deny access to those sites unless coming from your ip or ip range is you have dynamic ips.

  4. #4
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    <BLOCKQUOTE class="ip-ubbcode-quote"><font size="-1">quote:</font><HR>Originally posted by jollygoodpirate:
    For developing sites, here is how I do it. Put each site in its own port...

    http://192.168.1.100:8181/
    http://192.168.1.100:8182/
    http://192.168.1.100:8183/

    Then deny access to those sites unless coming from your ip or ip range is you have dynamic ips.<HR></BLOCKQUOTE>Great idea.

    ------------------------------
    "If all the newbies are going to start writing ebooks maybe I should get started on mine!" -- Buddha

  5. #5
    Just Lurking
    Join Date
    January 18th, 2005
    Posts
    1,263
    Too implement Jolly's idea you'll need to add LISTEN directives to your httpd.conf somewhere above PORT. Commented out (#) PORT. You'll need a LISTEN directive for each port.

    <pre class="ip-ubbcode-code-pre">LISTEN 9000
    LISTEN 9001
    LISTEN 9002
    # don't forget to add 80 if your still using it
    LISTEN 80</pre>

    You may want to use actual IP addresses in your VirtualHost directives not all servers support wildcard ports. Don't forget most misconfiguration can be avoided by running "apache -t".

    ------------------------------
    "If all the newbies are going to start writing ebooks maybe I should get started on mine!" -- Buddha

  6. #6
    Full Member jollygoodpirate's Avatar
    Join Date
    January 18th, 2005
    Location
    NC
    Posts
    227
    Indeed Buddha!

  7. Newsletter Signup

+ Reply to Thread

Similar Threads

  1. AutoFeed tips and search tips
    By JessieJ in forum PopShops
    Replies: 1
    Last Post: April 12th, 2009, 06:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •