Thanks to visit codestin.com
Credit goes to github.com

Skip to content

bind HTTPS to ipv6 port in NGINX example configuration #2492

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 24, 2017

Conversation

EyMaddis
Copy link
Contributor

Description:

The nginx configuration does not bind port 443 with IPv6 (but does so for 80).

Another thing I could change is the fact that (in my setup), the sites-available/hass file must not include the http {... } wrapping. I was not sure whether that is specific to my setup (fresh nginx installation via apt-get) so I did not change it yet.

@mention-bot
Copy link

@EyMaddis, thanks for your PR! By analyzing the history of the files in this pull request, we identified @balloob, @fabaff and @mweinelt to be potential reviewers.

@EyMaddis EyMaddis changed the title bind HTTPS to ipv6 port bind HTTPS to ipv6 port in NGINX example configuration Apr 23, 2017
@@ -111,6 +111,7 @@ http {

# These shouldn't need to be changed
listen 443 default_server;
listen [::]:443 default_server ipv6only=on;
Copy link
Contributor

@mweinelt mweinelt Apr 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unless you are on a very old machine you should be able to just

listen [::]:443 ssl http2 default_server;

As sysctl net.ipv6.bindv6only defaults to 0 on linux (not sure about other platforms) and so binding to ipv6 will also bind to the ipv6-mapped ipv4 address.

Rolling HTTP2 requires nginx >= 1.9.5, isn't the example missing the ssl statement?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am on my Raspberry Pi 3 running a Debian Jessie derivate (OSMC) and that does not work.

invalid parameter "http2" in /etc/nginx/sites-enabled/default:44

Also I tested it without http2 and it does not bind to IPv4.

I verified net.ipv6.bindv6only = 0

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As per https://trac.nginx.org/nginx/ticket/345 we might need to set ipv6only=off then.

When running Jessie the necessary nginx version is only available in the backports I'm afraid.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would argue that the current solution is the same as the port handling of port 80 (see above that line in the same file).
Binding to v6 individually works on every version, so I do not really see a reason to change the PR.

Copy link
Contributor

@mweinelt mweinelt Apr 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just tested and confirmed working:

listen [::]:443 ssl default_server ipv6only=off;

I don't feel strongly about saving a single line.

We should however note that http2 can be enabled given a recent enough nginx version.

@@ -110,7 +109,7 @@ http {


# These shouldn't need to be changed
listen 443 default_server;
listen [::]:443 default_server ipv6only=off; # if your nginx version is >= 1.9.5 you can also add the "http2" flag here
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm still quite certain this will make 443 a plain http port. Are you sure leaving out the ssl flag here is correct?

Copy link
Contributor Author

@EyMaddis EyMaddis Apr 23, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right below is ssl on which does the trick. I have this config running and working on my machine

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, cool!

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

So is this approved? Can you merge the changes please?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a member, just a contributor.

lgtm

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. But I guess you can approve your review, can't you? :)

Copy link
Member

@fabaff fabaff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks 🐦

@fabaff fabaff merged commit 1486a67 into home-assistant:current Apr 24, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants