configuration nginx server block [virtual host] with Ipv6.
    Vanhels 
    nginx-forum at forum.nginx.org
       
    Thu Mar  9 20:10:13 UTC 2017
    
    
  
Hi, I have installed nginx + php-fpm (php5.4 / php5.6), i'm trying to set
everything up for ipv6 in Centos 7.3, install from official nginx repo:
[/etc/nginx/nginx.conf]:
user  nginx;
worker_processes  1;
error_log  /var/log/nginx/error.log warn;
pid        /var/run/nginx.pid;
events {
    worker_connections  1024;
}
http {
    include       /etc/nginx/mime.types;
    default_type  application/octet-stream;
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request"
'
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';
    access_log  /var/log/nginx/access.log  main;
    sendfile        on;
    #tcp_nopush     on;
    keepalive_timeout  65;
    #gzip  on;
    include /etc/nginx/conf.d/*.conf;
}
[/etc/nginx/conf.d/default.conf]:
server {
    listen    [::]:80;
    server_name  localhost;
    location ~ \.php$ {
         root           html;
         fastcgi_split_path_info ^(.+\.php)(/.+)$;
         try_files $uri =404;
         fastcgi_pass   [::]:9056;
         fastcgi_index  index.php;
         fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
         include        fastcgi_params;
    }
    location / {
        root   /usr/share/nginx/html;
        index  index.php index.html index.htm;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;
    }
}
[domain1.conf]:
# create new
server {
    listen [::]:80;
    root   /home/domain1/public_html;
    index index.php index.html index.htm;
    server_name  domain1 www.domain1;
    location / {
        try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass [::]:9056;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 4k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
        fastcgi_intercept_errors on;
    }
 }
[subdomain.domain1.conf]:
# create new
server {
    listen [::]:80;
    root   /home/domain1/public_html/subdomain;
    index index.php index.html index.htm;
    server_name  subdomain.domain1 www.subdomain.domain1;
    location / {
        try_files $uri $uri/ =404;
    }
    location ~ \.php$ {
        try_files $uri =404;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass [::]:9056;
        fastcgi_index index.php;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
        include /etc/nginx/fastcgi_params;
        fastcgi_param PATH_INFO $fastcgi_script_name;
        fastcgi_buffer_size 128k;
        fastcgi_buffers 256 4k;
        fastcgi_busy_buffers_size 256k;
        fastcgi_temp_file_write_size 256k;
        fastcgi_intercept_errors on;
    }
}
If in [domain.conf] change to:
Listen 80;
fastcgi_pass 127.0.0.1:9056;
It works perfect, because this behavior I'm doing wrong,
thank you in advance for your answers,
Wilmer.
Posted at Nginx Forum: https://forum.nginx.org/read.php?2,272864,272864#msg-272864
    
    
More information about the nginx
mailing list