Linode Forum
Linode Community Forums
 FAQFAQ    SearchSearch    MembersMembers      Register Register 
 LoginLogin [ Anonymous ] 
Post new topic  Reply to topic
Author Message
 Post subject: NGINX ipv6
PostPosted: Tue Jan 31, 2012 1:39 pm 
Offline
Senior Newbie

Joined: Mon Dec 26, 2011 8:24 pm
Posts: 17
Hello,

I'm trying to enable ipv6 on nginx but when i change my listen directive and reboot the linode I can no longer access my website.

Here is my conf file



Code:
server {

   listen [::]:80;
   server_name www.shadowytree.com shadowytree.com;
   #access_log /srv/www/shadowytree.com/logs/access.log;
   error_log /srv/www/shadowytree.com/logs/error.log;
   
   #index index.html index.htm;
   
   location / {
      root /srv/www/shadowytree.com/public_html;
      index index.html index.htm index.php;
   }   
   
   location /nginx_status {
      stub_status on;
      access_log off;
      #uncomment and add an ip address if you want to block access to status page
      #allow SOME.IP.ADD.RESS;
      #deny all;
   }
   
   location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/shadowytree.com/public_html$fastcgi_script_name;
    }

}


server {

   listen [::]:443 ssl;
   ssl_certificate /srv/ssl/shadowytree.com.crt;
   ssl_certificate_key /srv/ssl/shadowytree.com.key;
   
   server_name www.shadowytree.com shadowytree.com;
   #access_log /srv/www/shadowytree.com/logs/access.log;
   error_log /srv/www/shadowytree.com/logs/error.log;
   
   keepalive_timeout 70;
   
   location / {
      root /srv/www/shadowytree.com/public_html;
      index index.html index.htm index.php;
   }   
   
   location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/shadowytree.com/public_html$fastcgi_script_name;
    }

}


If I removed the [::] parts everything works again. nginx is configured with ipv6 when I check it with nginx -V.

What am I missing?


Top
   
 Post subject:
PostPosted: Tue Jan 31, 2012 1:45 pm 
Offline
Junior Member

Joined: Tue Jan 31, 2012 6:17 am
Posts: 42
Website: https://www.serverfruit.com/
Location: Denmark
You run it on IPv6 only. Are you sure you are capable of running IPv6? What about making it so it both accept IPv4 and IPv6?

_________________
lakridserne
Serverfruit - shared and managed VPS hosting, SSL certificates and domains
Awesome servers rented from Linode!


Top
   
 Post subject:
PostPosted: Tue Jan 31, 2012 1:51 pm 
Offline
Senior Member

Joined: Mon Aug 29, 2011 2:34 am
Posts: 77
Do you have an IPv6 address brought up on your Linode? Looking at the DNS for shadowytree.com, there are no AAAA records, so you probably forgot to bring up an IPv6 address. (Now, in theory, this shouldn't be an issue, but who knows?) Also, re-add the [::] bits to your config, start nginx, and paste the output of 'netstat -tnap'


Top
   
 Post subject:
PostPosted: Tue Jan 31, 2012 1:52 pm 
Offline
Senior Member

Joined: Mon Aug 29, 2011 2:34 am
Posts: 77
lakridserne wrote:
You run it on IPv6 only. Are you sure you are capable of running IPv6? What about making it so it both accept IPv4 and IPv6?

That's not an issue; the Linux kernel by default binds sockets in such a way that IPv6 sockets listening on the any address ([::]) will also receive IPv4 traffic, with the source set to an IPv4-mapped IPv6 address.


Top
   
 Post subject:
PostPosted: Tue Jan 31, 2012 2:05 pm 
Offline
Senior Newbie

Joined: Mon Dec 26, 2011 8:24 pm
Posts: 17
This is what I get from tnap

Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 127.0.0.1:9000 0.0.0.0:* LISTEN 1811/php5-cgi
tcp 0 0 0.0.0.0:58313 0.0.0.0:* LISTEN 1527/rpc.statd
tcp 0 0 127.0.0.1:3306 0.0.0.0:* LISTEN 2158/mysqld
tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1515/portmap
tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1819/sshd
tcp 0 52 72.14.186.145:22 99.232.114.108:55272 ESTABLISHED 2344/0
tcp6 0 0 :::22 :::* LISTEN 1819/sshd


I have a ipv6 address set in dns manager and it is 2600:3c00::f03c:91ff:fedf:81a6

I created a recored with my domain name there too.


Top
   
 Post subject:
PostPosted: Tue Jan 31, 2012 2:09 pm 
Offline
Senior Member

Joined: Mon Aug 29, 2011 2:34 am
Posts: 77
Seems nginx didn't start; you should look at /srv/www/shadowytree.com/logs/error.log and /var/log/nginx/error_log to see what went wrong (and paste them so we all can see)


Top
   
 Post subject:
PostPosted: Tue Jan 31, 2012 2:13 pm 
Offline
Senior Newbie

Joined: Mon Dec 26, 2011 8:24 pm
Posts: 17
var/log/nginx/error_log

2012/01/31 13:11:58 [emerg] 2278#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2012/01/31 13:11:58 [emerg] 2278#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2012/01/31 13:11:58 [emerg] 2278#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2012/01/31 13:11:58 [emerg] 2278#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2012/01/31 13:11:58 [emerg] 2278#0: bind() to 0.0.0.0:80 failed (98: Address already in use)
2012/01/31 13:11:58 [emerg] 2278#0: still could not bind()


Nothing in shadowytree.com/logs/error.log


Top
   
 Post subject:
PostPosted: Tue Jan 31, 2012 2:23 pm 
Offline
Senior Member

Joined: Mon Aug 29, 2011 2:34 am
Posts: 77
Looks like too many things are trying to start nginx at the same time. Try '/etc/init.d/nginx start' and take a look at your error log


Top
   
 Post subject:
PostPosted: Tue Jan 31, 2012 2:26 pm 
Offline
Senior Newbie

Joined: Mon Dec 26, 2011 8:24 pm
Posts: 17
The following conf file seems to work.

Code:
server {

   listen   80; ## listen for ipv4; this line is default and implied
   listen   [::]:80 default ipv6only=on; ## listen for ipv6
   server_name www.shadowytree.com shadowytree.com;
   #access_log /srv/www/shadowytree.com/logs/access.log;
   error_log /srv/www/shadowytree.com/logs/error.log;
   
   #index index.html index.htm;
   
   location / {
      root /srv/www/shadowytree.com/public_html;
      index index.html index.htm index.php;
   }   
   
   location /nginx_status {
      stub_status on;
      access_log off;
      #uncomment and add an ip address if you want to block access to status page
      #allow SOME.IP.ADD.RESS;
      #deny all;
   }
   
   location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/shadowytree.com/public_html$fastcgi_script_name;
    }

}


server {

   listen 443 ssl;
   listen [::]:443 default ipv6only=on;
   ssl_certificate /srv/ssl/shadowytree.com.crt;
   ssl_certificate_key /srv/ssl/shadowytree.com.key;
   
   server_name www.shadowytree.com shadowytree.com;
   #access_log /srv/www/shadowytree.com/logs/access.log;
   error_log /srv/www/shadowytree.com/logs/error.log;
   
   keepalive_timeout 70;
   
   location / {
      root /srv/www/shadowytree.com/public_html;
      index index.html index.htm index.php;
   }   
   
   location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/shadowytree.com/public_html$fastcgi_script_name;
    }

}


Will try and see nginx start and see what error message I get.


Top
   
 Post subject:
PostPosted: Tue Jan 31, 2012 3:36 pm 
Offline
Junior Member

Joined: Tue Jan 31, 2012 6:17 am
Posts: 42
Website: https://www.serverfruit.com/
Location: Denmark
dwfreed wrote:
lakridserne wrote:
You run it on IPv6 only. Are you sure you are capable of running IPv6? What about making it so it both accept IPv4 and IPv6?

That's not an issue; the Linux kernel by default binds sockets in such a way that IPv6 sockets listening on the any address ([::]) will also receive IPv4 traffic, with the source set to an IPv4-mapped IPv6 address.


Oh I wasn't aware of that.

_________________
lakridserne
Serverfruit - shared and managed VPS hosting, SSL certificates and domains
Awesome servers rented from Linode!


Top
   
 Post subject: Re: NGINX ipv6
PostPosted: Sat Feb 25, 2012 5:58 am 
Offline
Newbie

Joined: Sat Feb 25, 2012 5:43 am
Posts: 4
Finglor wrote:
Hello,

I'm trying to enable ipv6 on nginx but when i change my listen directive and reboot the linode I can no longer access my website.

Here is my conf file



Code:
server {

   listen [::]:80;
   server_name www.shadowytree.com shadowytree.com;
   #access_log /srv/www/shadowytree.com/logs/access.log;
   error_log /srv/www/shadowytree.com/logs/error.log;
   
   #index index.html index.htm;
   
   location / {
      root /srv/www/shadowytree.com/public_html;
      index index.html index.htm index.php;
   }   
   
   location /nginx_status {
      stub_status on;
      access_log off;
      #uncomment and add an ip address if you want to block access to status page
      #allow SOME.IP.ADD.RESS;
      #deny all;
   }
   
   location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/shadowytree.com/public_html$fastcgi_script_name;
    }

}


server {

   listen [::]:443 ssl;
   ssl_certificate /srv/ssl/shadowytree.com.crt;
   ssl_certificate_key /srv/ssl/shadowytree.com.key;
   
   server_name www.shadowytree.com shadowytree.com;
   #access_log /srv/www/shadowytree.com/logs/access.log;
   error_log /srv/www/shadowytree.com/logs/error.log;
   
   keepalive_timeout 70;
   
   location / {
      root /srv/www/shadowytree.com/public_html;
      index index.html index.htm index.php;
   }   
   
   location ~ \.php$ {
        include /etc/nginx/fastcgi_params;
        fastcgi_pass  127.0.0.1:9000;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME /srv/www/shadowytree.com/public_html$fastcgi_script_name;
    }

}


If I removed the [::] parts everything works again. nginx is configured with ipv6 when I check it with nginx -V.

What am I missing?


I know this seems dumb, but were you listening on 80/443 before the migration?


Top
   
 Post subject:
PostPosted: Sat Feb 25, 2012 6:43 am 
Offline
Senior Member
User avatar

Joined: Fri Oct 24, 2003 3:51 pm
Posts: 965
Location: Netherlands
I know this seems dumb, but why are you putting the spam in the quote, instead of in your sig?

_________________
/ Peter


Top
   
 Post subject: Buuuusted.
PostPosted: Sat Feb 25, 2012 10:50 am 
Offline
Newbie

Joined: Sat Feb 25, 2012 5:43 am
Posts: 4
I thought it would be less intrusive... DOH!

Hey, at least my English is nothing shy of perfect. :)

Do you want me to change it?


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
RSS

Powered by phpBB® Forum Software © phpBB Group