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

    Two Apache Virtual Hosts, One Server, Port 80

    IT Discussion
    4
    17
    2.1k
    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.
    • T
      thanksajdotcom
      last edited by

      So I talked to SAM earlier and are getting my server setup more correctly. I had my website hosted all within the /var/www/html folder. Now I have a /var/www/thanksaj.com. Well, with this newly discovered development on how to do this, I am setting up a web server for @Minion-Queen . I have setup the folder in /var/www for the website, I have created the virtual host in apache and brought it all up. So far my website still loads fine, so no issues there. However, I need to know...

      1. Do I need to do anything special with ports, etc? Does it need to be redirected from port 80, because that has caused issues with Wordpress that I've seen.
      2. What else do I need to do to get this functional?

      Thanks!
      A.J.

      1 Reply Last reply Reply Quote 0
      • S
        scottalanmiller
        last edited by

        No redirects. Only on Apache server is running and everything on it uses port 80.

        1 Reply Last reply Reply Quote 0
        • T
          thanksajdotcom
          last edited by

          Ok, so how do I segregate the traffic to the proper locations?

          1 Reply Last reply Reply Quote 0
          • S
            scottalanmiller
            last edited by

            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.

            T 1 Reply Last reply Reply Quote 0
            • T
              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?

              S 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.

                T 1 Reply Last reply Reply Quote 0
                • S
                  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
                  • T
                    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?

                      T 1 Reply Last reply Reply Quote 0
                      • T
                        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.

                        J 1 Reply Last reply Reply Quote 0
                        • J
                          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.

                          T 1 Reply Last reply Reply Quote 0
                          • J
                            JaredBusch
                            last edited by

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

                            <VirtualHost *:80>
                            	ServerAdmin sorvani@gmail.com
                            	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 sorvani@gmail.com
                               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
                            • J
                              JaredBusch
                              last edited by

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

                              T 1 Reply Last reply Reply Quote 1
                              • T
                                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". 😛

                                T 1 Reply Last reply Reply Quote 0
                                • T
                                  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
                                  • T
                                    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
                                    • J
                                      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