CentOS7 - Apache Virtual Hosts
-
@Aaron-Studer said:
I would just prefer if it went to the default page.
That's a bizarre preference. This falls under what I call "being weird." Why are you the only person who wants to do this? Why does no other company or person want this? It's your person machine, you can do what you want, but you are being weird here. I don't know how else to describe it. As a personal site, whatever. But if this was a business, someone should be demanding that you provide logic for deviating from accepted behaviour. What's your goal here? You just really love advertising your information about your platform and looking like you made a mistake?
-
Can someone give me an example or guide with one conf file?
-
@Aaron-Studer said:
Can someone give me an example or guide with one conf file?
There is nothing to know, really. You just tack the configuration on to the end of the httpd.conf file. Single file is the CentOS default. You need no guide, just edit the file.
-
@Aaron-Studer said:
Can someone give me an example or guide with one conf file?
You just put it all together, modules first, basic config (for modules) after that, default document stuff/base document configuration and security configuration, then at the end virtual hosts. That's the most common way. All you really need to do is go through your main config file and see where it references other files, and put the content of those files where the old include was.
-
@scottalanmiller said:
@Aaron-Studer said:
I would just prefer if it went to the default page.
That's a bizarre preference. This falls under what I call "being weird." Why are you the only person who wants to do this? Why does no other company or person want this? It's your person machine, you can do what you want, but you are being weird here. I don't know how else to describe it. As a personal site, whatever. But if this was a business, someone should be demanding that you provide logic for deviating from accepted behaviour. What's your goal here? You just really love advertising your information about your platform and looking like you made a mistake?
This.
No one wants a banner on the site saying "Hey, were running CentOS 7.x, Apache version X etc."
-
@thecreativeone91 said:
No one wants a banner on the site saying "Hey, were running CentOS 7.x, Apache version X etc."
That's a good point, I will just make a simple html file that says test.
-
@Aaron-Studer said:
@thecreativeone91 said:
No one wants a banner on the site saying "Hey, were running CentOS 7.x, Apache version X etc."
That's a good point, I will just make a simple html file that says test.
But it isn't a test. It's another website that you are running for some purpose. Why would you say test?
-
No one wants to see a non-test pretending to be a test banner either
-
What people want to know, when they go to an IP address, is what site is there or who is running it. Normally if you are small, like NTG, you put your main website there. If you are a commercial host you put advertising there so that people who are wondering who is hosting a page can easily find out and maybe buy services from you.
-
Can I make it just not resolve?
-
@Aaron-Studer said:
Can I make it just not resolve?
Again, why? Sure, you can make it error out, point it to nothing. But what is driving you to put in effort to make your site not as nice?
-
@Aaron-Studer said:
Can I make it just not resolve?
You can make it go to a blank page I suppose but why? What are you trying to prevent?
-
@Aaron-Studer said:
Can I make it just not resolve?
Yeah, just make it call either a file which does not exist (it will log in your error log though) or make it return the 404 header and the 404 html document that comes with Apache, that's essentially the same thing as "not resolving," assuming that's what you meant.
-
What s the reasoning of wanting to block the ip address?
-
You have some strong motivation here that you are not sharing. The Google thing isn't valid, that's not how search engines behave. It's not about being good for end users. It's not helpful to you. It's not a best practice. There is something you think you are accomplishing here that you are not willing to share with us. Do you believe this to be some kind of security problem?
-
It just don't make since in my head to have a IP address resolve.... Only a domain. Maybe my head is the issue
-
@Aaron-Studer said:
It just don't make since in my head to have a IP address resolve.... Only a domain. Maybe my head is the issue
Why? Most do. http://216.58.217.142/
-
@Aaron-Studer said:
It just don't make since in my head to have a IP address resolve.... Only a domain. Maybe my head is the issue
It does make sense and that's why I've never heard of someone not wanting it to do this. It's the only logical thing for it to do. And remember, originally, this was the ONLY way we had websites. You are thinking of DNS as more ubiquitous than it should be.
-
@Aaron-Studer said:
It just don't make since in my head to have a IP address resolve.... Only a domain. Maybe my head is the issue
You're only used to HTTP/1.1, but a long time ago in 1.0 it was something to consider, but now you don't have to worry about it. The only scenario is if someone manually does it, in which case you typically just want to return your main page anyway or 404, otherwise it will return the default virtual host if it exists. The way Apache works is, if no host is sent in the GET/POST/PUT/etc request then it will try to find the default virtual host (if virtual host module is enabled) and if that fails it will load whatever is in the default document path.
This is also for reverse compatibility with HTTP/1.0, and while pretty unlikely something will use that, it's such a simple configuration issue why not just support it?
-
Or more importantly.... why put in extra effort to break it?