1

I disabled the virtual host *:80 and I had a 400 bad request when trying to connect to my website.

I set it back and it worked again. But I dont want or need a virtual host all I need is accept connection to my server on ports 80 and 443 and both serve the same content.

Is it required to create a virtual host? Or is it because there is another virtualHost for the *:443 https that the server responded with a 400 bad request ?

It's empty like that

<VirtualHost *:80>
</VirtualHost>

wildcard NameVirtualHosts and _default_ servers:

_default_:443          some-ip.us-west-2.compute.internal (/etc/httpd/conf.d/ssl.conf:74)

*:80                   some-ip.us-west-2.compute.internal (/etc/httpd/conf/httpd.conf:1005)
2
  • Yes, if you want to have an SSL listener and a non-SSL listener, you'll need at least one virtual host -- but the :80 one isn't required, just the :443 one. Can you provide more specific details about your configuration, like what you've set up in configuration files and the output from apachectl -s? Jun 1 '13 at 22:30
  • VirtualHost configuration: wildcard NameVirtualHosts and default servers: default:443 ec2-ip.us-west-2.compute.internal (/etc/httpd/conf.d/ssl.conf:74) *:80 ec2-ip.us-west-2.compute.internal (/etc/httpd/conf/httpd.conf:1005) Syntax OK Jun 1 '13 at 22:34
2

The reason you need virtual hosts in this case is that even though they serve the same content, there is still a difference between the two ports. One of them has SSL enabled, the other one doesn't. So you need to explain to apache how to know which config to use for which port, and VirtualHost is how you do it.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.