Apache 2.4 version configures those pits of ssl/https

 

There are always some mistakes that cannot be prevented. If you are configuring  https on apache2.4  , it seems that all the configurations are correct, and there are still errors after referring to many articles, then there is only one possibility, and that is  VirtualHostthe domain name of the monitor. The port is wrong.

Do you want to vent a little? Last night, I configured this problem for 4 hours, and deleted the last line of code before I found the point of the problem. It can also be said that I did  n’t know VirtualHost enough about it.

There is only one solution: either do a virtual host based on IP, or do a virtual host based on name, do not mix, do not mix, otherwise the priority is definitely a big hole, and it is recommended to do it based on name, that is <VirtualHost *:443>

My original configuration was

 

<VirtualHost localhost:443>

...

</VirtualHost>

<VirtualHost www.example.com:443>

...

</VirtualHost>

 

For  VirtualHost, the official set is as follows:

 

<VirtualHost addr[:port] [addr[:port]] ...> ... </VirtualHost>

That is, you can listen on multiple addresses and multiple ports

For  addr this paragraph, the official description is as follows

 

+ IP of the virtual host

+ the full name of the domain name, not recommended

+ * sign, that is, you can monitor multiple IPs

+ _default_ This is an alias for *

 

It is important to know that VirtualHost has two configuration methods, IP address-based virtual hosting and name-based virtual hosting, and, you can't mix the two, yes, you can't mix the two

At the beginning, what I mastered was only good, and then I felt that I could fill in the IP, so I filled it in. Once the IP is filled in, the priority will be fooled.

Then, the official paragraph below is also very useful, and I think it is the most useful paragraph in the entire document:

If you're debugging a virtual host configuration, you'll find Apache's command-line parameter -S very useful. That is, enter the following command:
/usr/local/apache2/bin/httpd -S
This command will show how Apache parses the configuration file. Double-checking the IP address and server name may help you spot configuration errors

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324928621&siteId=291194637