How do I set up IP addresses for different folders on server?

Discussion in 'Apache' started by sisom, Feb 9, 2011.

  1. #1
    Hi, I have an Apache server with Fasthosts, and I already have three sites set up on it (I didn't set them up), but I am slowly learning how to do things, and have set up two new sites in a sub folder of one of the main sites. I now realise I need an SSL certificate, and that these two new sites will have to have their own /home/site folder, i.e. the other three sites are under
    /home/site1/public_html
    /home/site2/public_html
    /home/site3/public_html

    and currently the two new sites are under
    /home/site1/public_html/newsite1
    /home/site1/public_html/newsite2

    When the first three sites were set up for me, they were assigned IP addresses. I've asked the company who did it for me if they could tell me how they did it, as I'm sure it's just a matter of editing a config file somewhere, but they said they would give me a quote for them doing it, which I don't want, as I'm sure I can do it myself with a little bit of instructions.

    Here's what my server's folders look like:

    etc/httpd/conf
    etc/httpd/conf.d
    etc/httpd/sites

    etc/httpd/conf/httpd.conf looks like this, lines 207 - 210:

    #
    # Load config files from the config directory "/etc/httpd/conf.d".
    #
    Include conf.d/*.conf

    so I presume it's reading all the .conf files in the /conf.d folder.

    I already have three sites set up (by an installation company), and this is what they have in the
    etc/httpd/conf.d
    folder, files called
    www.mydomain.com.conf

    which are like this (IP address redacted):

    <VirtualHost XX.XXX.XXX.XX:80>
    Include sites/www.mydomain.com.conf
    </VirtualHost>

    <VirtualHost XX.XXX.XXX.XX:443>
    SSLCertificateFile /etc/httpd/ssl/mydomain.com.crt
    SSLCACertificateFile /etc/httpd/ssl/mydomain.com.ca
    SSLCertificateKeyFile /etc/httpd/ssl/mydomain.com.key
    Include sites/ssl-common.conf
    Include sites/www.mydomain.com.conf
    </VirtualHost>

    so I looked in
    etc/httpd/sites
    and www.mydomain.com.conf is also in there, but this time it looks like this:

    ServerName www.mydomain.com
    ServerAlias mydomain.com

    DocumentRoot /home/mydomain/public_html
    <Directory /home/mydomain/public_html>
    Allow From All
    AllowOverride All
    </Directory>


    I've created a /home/mynewdomain
    and
    /home/mynewdomain/public_html
    folder, and put my site into it. I've set the permissions of all the folders and all the files to the same as those of the three sites that are already running. I've copied the two .conf files above and inserted the correct IP address (I have bought a new IP address to add to the three that are already set up for the server), and changed the 'mydomain' part to the real domain name. But when I go to the IP address in my browser, it won't load, and I eventually get a message: "The server at XX.XXX.XXX.XX is taking too long to respond."

    Is there anywhere else that I have missed, which I should edit? I thought I had covered everything, but it's just not working. (I'm not using the domain name in my browser yet, because the site is actually up at the moment, but in a subfolder of one of the three websites that are already running on the server, and using an .htaccess file to redirect to it. I'm going to install an SSL certificate tomorrow (yeah right!) so I have to have an IP address for the domain name).

    Many thanks in advance if anyone can help me, I'm sure there is something very simple that I've missed. I did read the Apache guide, here:
    http://httpd.apache.org/docs/2.0/vhosts/ip-based.html
    but it didn't help me.
     
    sisom, Feb 9, 2011 IP
  2. fantome2024

    fantome2024 Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    this is how I setup my virtual host redirection

    <VirtualHost *:80>
    ServerAdmin
    DocumentRoot /var/www/html/name1
    ServerName name1.org
    ServerAlias name1.org
    ServerAlias "www.name1.org"
    ErrorLog /var/log/httpd/name1/error_logs
    CustomLog /var/log/httpd/name1/access_log common
    </VirtualHost>
     
    fantome2024, Mar 3, 2011 IP
  3. fantome2024

    fantome2024 Peon

    Messages:
    14
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    note remove the " " around the serverAlias www address
     
    fantome2024, Mar 3, 2011 IP