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

    CentOS7 - Apache Virtual Hosts

    Scheduled Pinned Locked Moved IT Discussion
    44 Posts 4 Posters 8.9k 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.
    • ?
      A Former User
      last edited by A Former User

      So I setup my first Virtual Host on CentOS7, and it seems to be working, however when I go to the server IP, and get the site too.

      Shouldn't the IP address not resolve, or resolve to the default CentOS7 Apache page?

      1 Reply Last reply Reply Quote 1
      • scottalanmillerS
        scottalanmiller
        last edited by

        By "default" the way that VirtualHosts are set up, there is a default option that goes to a real page, not to the old default page.

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

          Do you WANT to show the default Apache page as a form of error page or something?

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

            @scottalanmiller said:

            Do you WANT to show the default Apache page as a form of error page or something?

            Correct.

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

              While I look up how to do that.... why?

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

                Do I need to setup a virtual host for the IP address?

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

                  @scottalanmiller said:

                  While I look up how to do that.... why?

                  Because I don't want Google finding the IP address, and using it for search results.

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

                    @Aaron-Studer said:

                    Do I need to setup a virtual host for the IP address?

                    Yes, when all blocks fail, Apache chooses the first block. So create a block that goes to the Apache page with no other settings and make it first.

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

                      @Aaron-Studer said:

                      @scottalanmiller said:

                      While I look up how to do that.... why?

                      Because I don't want Google finding the IP address, and using it for search results.

                      Have you ever seen that happen?

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

                        @scottalanmiller said:

                        Have you ever seen that happen?

                        No, but I could see it happening.

                        ? scottalanmillerS 2 Replies Last reply Reply Quote 0
                        • ?
                          A Former User @scottalanmiller
                          last edited by

                          @scottalanmiller said:

                          Yes, when all blocks fail, Apache chooses the first block. So create a block that goes to the Apache page with no other settings and make it first.

                          I am confused. I thought I create a conf file for each site? What your saying, sounds like one conf file for all sites?

                          Using this guide if it matters: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-7

                          tonyshowoffT scottalanmillerS 2 Replies Last reply Reply Quote 0
                          • tonyshowoffT
                            tonyshowoff
                            last edited by tonyshowoff

                            Look for:

                            VirtualHost _default_:80
                            

                            That's likely what's being triggered, if that doesn't exist, it often will fall back to the main default page

                            1 Reply Last reply Reply Quote 0
                            • tonyshowoffT
                              tonyshowoff @A Former User
                              last edited by

                              @Aaron-Studer said:

                              @scottalanmiller said:

                              Yes, when all blocks fail, Apache chooses the first block. So create a block that goes to the Apache page with no other settings and make it first.

                              I am confused. I thought I create a conf file for each site? What your saying, sounds like one conf file for all sites?

                              Using this guide if it matters: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-7

                              You can, but it's a pain to manage. I usually just have a single configuration file. The only real reason to have multiple files is if you do a lot of editing, very often of them.

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

                                @Aaron-Studer said:

                                @scottalanmiller said:

                                Have you ever seen that happen?

                                No, but I could see it happening.

                                Why is that an issue? it's not like you are really hiding anything or protecting anything like that.

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

                                  I would just prefer if it went to the default page.

                                  ? scottalanmillerS 2 Replies Last reply Reply Quote 0
                                  • ?
                                    A Former User @A Former User
                                    last edited by

                                    @Aaron-Studer said:

                                    I would just prefer if it went to the default page.

                                    you are giving much more information away about the server that way.

                                    1 Reply Last reply Reply Quote 0
                                    • tonyshowoffT
                                      tonyshowoff
                                      last edited by

                                      From a "just in case" perspective it's good to have something if the virtual host either does not exist or someone goes right to the IP. We set both the default:80 virtual host and the regular default page to this, and it's not an issue, though as I said, I'd check your virtual hosts if regular default page is not working.

                                      1 Reply Last reply Reply Quote 1
                                      • scottalanmillerS
                                        scottalanmiller @A Former User
                                        last edited by

                                        @Aaron-Studer said:

                                        @scottalanmiller said:

                                        Have you ever seen that happen?

                                        No, but I could see it happening.

                                        That's not a good reason to do this. Google definitely doesn't do that. That you could "see programmers screwing things up on a global scale but they never have and they would fix it if they did" isn't a good reason to do weird things.

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

                                          @Aaron-Studer said:

                                          @scottalanmiller said:

                                          Yes, when all blocks fail, Apache chooses the first block. So create a block that goes to the Apache page with no other settings and make it first.

                                          I am confused. I thought I create a conf file for each site? What your saying, sounds like one conf file for all sites?

                                          Using this guide if it matters: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-7

                                          Whether you make one or many, they get turned into one before being used. That they are separate files to you is purely for you.

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

                                            @tonyshowoff said:

                                            @Aaron-Studer said:

                                            @scottalanmiller said:

                                            Yes, when all blocks fail, Apache chooses the first block. So create a block that goes to the Apache page with no other settings and make it first.

                                            I am confused. I thought I create a conf file for each site? What your saying, sounds like one conf file for all sites?

                                            Using this guide if it matters: https://www.digitalocean.com/community/tutorials/how-to-set-up-apache-virtual-hosts-on-centos-7

                                            You can, but it's a pain to manage. I usually just have a single configuration file. The only real reason to have multiple files is if you do a lot of editing, very often of them.

                                            Yup, I normally just use one. Maybe if you have thousands of sites.

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