ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Two Apache Virtual Hosts, One Server, Port 80

    Scheduled Pinned Locked Moved IT Discussion
    17 Posts 4 Posters 2.3k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thanksajdotcomT
      thanksajdotcom @scottalanmiller
      last edited by

      @scottalanmiller said:

      What you are going to use here are called host headers. The Apache server actually reads the HTTP has it comes across and looks in it to see which site is requested. It then directs that request to the correct virtual server.

      Ok, so do I just need to lookup how to setup host headers in Ubuntu? Or is that just a function in Apache I need to tweak somewhere?

      scottalanmillerS 1 Reply Last reply Reply Quote 0
      • ?
        A Former User
        last edited by

        Ah, vhosts. It's pretty simple. It see what domain was requested and use the correct directory. You will have to use the dns name to browse the site though, IP address won't return the correct website with vhosts of course since their is only one.

        thanksajdotcomT 1 Reply Last reply Reply Quote 0
        • scottalanmillerS
          scottalanmiller @thanksajdotcom
          last edited by

          @ajstringham said:

          @scottalanmiller said:

          What you are going to use here are called host headers. The Apache server actually reads the HTTP has it comes across and looks in it to see which site is requested. It then directs that request to the correct virtual server.

          Ok, so do I just need to lookup how to setup host headers in Ubuntu? Or is that just a function in Apache I need to tweak somewhere?

          Just Apache.

          1 Reply Last reply Reply Quote 0
          • thanksajdotcomT
            thanksajdotcom @A Former User
            last edited by

            @thecreativeone91 said:

            Ah, vhosts. It's pretty simple. It see what domain was requested and use the correct directory. You will have to use the dns name to browse the site though, IP address won't return the correct website with vhosts of course since their is only one.

            DNS name is fine. That's how it'll be used exclusively.

            I've followed this, updated for Ubuntu 14.04 (always a couple tweaks).
            https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-ubuntu-12-04-lts

            Can you see anything I'm missing to get DNS working?

            ? 1 Reply Last reply Reply Quote 0
            • ?
              A Former User @thanksajdotcom
              last edited by

              @ajstringham What is it currently doing/what's your error?

              thanksajdotcomT 1 Reply Last reply Reply Quote 0
              • thanksajdotcomT
                thanksajdotcom @A Former User
                last edited by

                @thecreativeone91 said:

                @ajstringham What is it currently doing/what's your error?

                The site currently loads my site correctly but not the other website. Everything appears to be setup correctly. I can't figure out what the issue is.

                JaredBuschJ 1 Reply Last reply Reply Quote 0
                • JaredBuschJ
                  JaredBusch @thanksajdotcom
                  last edited by

                  @ajstringham said:

                  @thecreativeone91 said:

                  @ajstringham What is it currently doing/what's your error?

                  The site currently loads my site correctly but not the other website. Everything appears to be setup correctly. I can't figure out what the issue is.

                  Assuming this is still hosted internally, is your hairpin NAT rules picking up the second DNS name and rerouting appropriately? I cannot think of a scenario that wouldn't since it should all revolve around the IP, but just another thing to check.

                  thanksajdotcomT 1 Reply Last reply Reply Quote 0
                  • JaredBuschJ
                    JaredBusch
                    last edited by

                    my httpd.conf (CentOS 6.5) looks like this:

                    <VirtualHost *:80>
                    	ServerAdmin [email protected]
                    	DirectoryIndex index.html
                    	DocumentRoot /var/www/daerma.com
                    	ServerName daerma.com
                    	ServerAlias *.daerma.com
                    	LogLevel warn
                    	ErrorLog logs/daerma.com-error_log
                    	CustomLog logs/daerma.com-access_log common
                    </VirtualHost>
                    <VirtualHost *:80>
                       ServerAdmin [email protected]
                       DirectoryIndex index.php index.html index.htm
                       DocumentRoot /var/www/jaredbusch.com
                       ServerName jaredbusch.com
                       ServerAlias *.jaredbusch.com
                       LogLevel Warn
                       ErrorLog logs/jaredbusch.com-error_log
                       CustomLog logs/jaredbusch.com-access_log common
                    </VirtualHost>
                    
                    1 Reply Last reply Reply Quote 0
                    • JaredBuschJ
                      JaredBusch
                      last edited by

                      and no, there is nothing on jaredbusch.com yet. I just bought it because it was available.

                      thanksajdotcomT 1 Reply Last reply Reply Quote 1
                      • thanksajdotcomT
                        thanksajdotcom @JaredBusch
                        last edited by

                        @JaredBusch said:

                        and no, there is nothing on jaredbusch.com yet. I just bought it because it was available.

                        It should have been "youcametojared.com". 😛

                        thanksajdotcomT 1 Reply Last reply Reply Quote 0
                        • thanksajdotcomT
                          thanksajdotcom @thanksajdotcom
                          last edited by

                          @ajstringham said:

                          @JaredBusch said:

                          and no, there is nothing on jaredbusch.com yet. I just bought it because it was available.

                          It should have been "youcametojared.com". 😛

                          Then again, this could send entirely the wrong message...

                          1 Reply Last reply Reply Quote 0
                          • thanksajdotcomT
                            thanksajdotcom @JaredBusch
                            last edited by

                            @JaredBusch said:

                            @ajstringham said:

                            @thecreativeone91 said:

                            @ajstringham What is it currently doing/what's your error?

                            The site currently loads my site correctly but not the other website. Everything appears to be setup correctly. I can't figure out what the issue is.

                            Assuming this is still hosted internally, is your hairpin NAT rules picking up the second DNS name and rerouting appropriately? I cannot think of a scenario that wouldn't since it should all revolve around the IP, but just another thing to check.

                            Hairpin NAT rules?

                            1 Reply Last reply Reply Quote 0
                            • JaredBuschJ
                              JaredBusch
                              last edited by

                              @ajstringham said:

                              @JaredBusch said:

                              @ajstringham said:

                              @thecreativeone91 said:

                              @ajstringham What is it currently doing/what's your error?

                              The site currently loads my site correctly but not the other website. Everything appears to be setup correctly. I can't figure out what the issue is.

                              Assuming this is still hosted internally, is your hairpin NAT rules picking up the second DNS name and rerouting appropriately? I cannot think of a scenario that wouldn't since it should all revolve around the IP, but just another thing to check.

                              Hairpin NAT rules?

                              When you host stuff at home, you will have a problem with NAT.

                              daerma.com resolves publicly my current IP.
                              but the internal server is on a local IP of course.
                              By default that means daerma.com should not be reachable from inside my network. because a DNS lookup will return the public IP. A router running standard NAT masquerade rules will not route it correctly because it is targeting the WAN port of the router from the LAN.
                              So there were special NAT rules called hairpining designed to handle it.
                              http://en.wikipedia.org/wiki/Hairpinning

                              Almost every home router has it enabled by defualt. I have no idea how dd-wrt handles it, other than to know it has the functionality.

                              1 Reply Last reply Reply Quote 0
                              • 1 / 1
                              • First post
                                Last post