Here's the proposal patch
From 92eaf0278ff14f67255e03ee0f2f9536c83f64d1 Mon Sep 17 00:00:00 2001 From: Eric Desrochers <eric.desroch...@canonical.com> Date: Mon, 21 Oct 2019 21:08:44 -0400 Subject: [PATCH] Allow nginx to start on ipv6 disabled system
--- debian/changelog | 7 ++ .../sites-available/{default => default-ipv6} | 0 debian/conf/sites-available/default-noipv6 | 91 +++++++++++++++++++ debian/nginx-common.postinst | 11 ++- 4 files changed, 107 insertions(+), 2 deletions(-) rename debian/conf/sites-available/{default => default-ipv6} (100%) create mode 100644 debian/conf/sites-available/default-noipv6 diff --git a/debian/changelog b/debian/changelog index a692f86..da11559 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,10 @@ +nginx (1.16.1-3) unstable; urgency=medium + + * Allow nginx to start and complete the install + on ipv6 disabled system (Closes: #942817) + + -- Eric Desrochers <eric.desroch...@canonical.com> Mon, 21 Oct 2019 21:06:25 -0400 + nginx (1.16.1-2) unstable; urgency=medium * http-lua: Downgrade to 0.10.13 (Closes: #941917) diff --git a/debian/conf/sites-available/default b/debian/conf/sites-available/default-ipv6 similarity index 100% rename from debian/conf/sites-available/default rename to debian/conf/sites-available/default-ipv6 diff --git a/debian/conf/sites-available/default-noipv6 b/debian/conf/sites-available/default-noipv6 new file mode 100644 index 0000000..ba91b6b --- /dev/null +++ b/debian/conf/sites-available/default-noipv6 @@ -0,0 +1,91 @@ +## +# You should look at the following URL's in order to grasp a solid understanding +# of Nginx configuration files in order to fully unleash the power of Nginx. +# https://www.nginx.com/resources/wiki/start/ +# https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/ +# https://wiki.debian.org/Nginx/DirectoryStructure +# +# In most cases, administrators will remove this file from sites-enabled/ and +# leave it as reference inside of sites-available where it will continue to be +# updated by the nginx packaging team. +# +# This file will automatically load configuration files provided by other +# applications, such as Drupal or Wordpress. These applications will be made +# available underneath a path with that package name, such as /drupal8. +# +# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples. +## + +# Default server configuration +# +server { + listen 80 default_server; + #listen [::]:80 default_server; + + # SSL configuration + # + # listen 443 ssl default_server; + # listen [::]:443 ssl default_server; + # + # Note: You should disable gzip for SSL traffic. + # See: https://bugs.debian.org/773332 + # + # Read up on ssl_ciphers to ensure a secure configuration. + # See: https://bugs.debian.org/765782 + # + # Self signed certs generated by the ssl-cert package + # Don't use them in a production server! + # + # include snippets/snakeoil.conf; + + root /var/www/html; + + # Add index.php to the list if you are using PHP + index index.html index.htm index.nginx-debian.html; + + server_name _; + + location / { + # First attempt to serve request as file, then + # as directory, then fall back to displaying a 404. + try_files $uri $uri/ =404; + } + + # pass PHP scripts to FastCGI server + # + #location ~ \.php$ { + # include snippets/fastcgi-php.conf; + # + # # With php-fpm (or other unix sockets): + # fastcgi_pass unix:/run/php/php7.3-fpm.sock; + # # With php-cgi (or other tcp sockets): + # fastcgi_pass 127.0.0.1:9000; + #} + + # deny access to .htaccess files, if Apache's document root + # concurs with nginx's one + # + #location ~ /\.ht { + # deny all; + #} +} + + +# Virtual Host configuration for example.com +# +# You can move that to a different file under sites-available/ and symlink that +# to sites-enabled/ to enable it. +# +#server { +# listen 80; +# listen [::]:80; +# +# server_name example.com; +# +# root /var/www/example.com; +# index index.html; +# +# location / { +# try_files $uri $uri/ =404; +# } +#} diff --git a/debian/nginx-common.postinst b/debian/nginx-common.postinst index f83032d..3dae290 100644 --- a/debian/nginx-common.postinst +++ b/debian/nginx-common.postinst @@ -47,10 +47,17 @@ case "$1" in # If a symlink doesn't exist and can be created, then create it. if [ -z $2 ] && [ ! -e /etc/nginx/sites-enabled/default ] && - [ -d /etc/nginx/sites-enabled ] && [ -d /etc/nginx/sites-available ]; then - ln -s /etc/nginx/sites-available/default /etc/nginx/sites-enabled/default + [ -d /etc/nginx/sites-enabled ] && [ -d /etc/nginx/sites-available ] && + [ ! -f /proc/net/if_inet6 ]; then + ln -s /etc/nginx/sites-available/default-noipv6 /etc/nginx/sites-enabled/default fi + if [ -z $2 ] && [ ! -e /etc/nginx/sites-enabled/default ] && + [ -d /etc/nginx/sites-enabled ] && [ -d /etc/nginx/sites-available ] && + [ -f /proc/net/if_inet6 ]; then + ln -s /etc/nginx/sites-available/default-ipv6 /etc/nginx/sites-enabled/default + fi + # Create a default index page when not already present. if [ ! -e /var/www/html/index.nginx-debian.html ]; then cp /usr/share/nginx/html/index.html /var/www/html/index.nginx-debian.html -- 2.17.1