Welcome! Log In Create A New Profile

Advanced

configuration nginx server block [virtual host] with Ipv6.

March 09, 2017 03:10PM
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.
Subject Author Posted

configuration nginx server block [virtual host] with Ipv6.

Vanhels March 09, 2017 03:10PM

Re: configuration nginx server block [virtual host] with Ipv6.

Francis Daly March 09, 2017 05:38PM

Re: configuration nginx server block [virtual host] with Ipv6.

Vanhels March 09, 2017 06:06PM

Re: configuration nginx server block [virtual host] with Ipv6.

Francis Daly March 10, 2017 08:02PM

Re: configuration nginx server block [virtual host] with Ipv6.

Vanhels March 10, 2017 08:08PM

Re: configuration nginx server block [virtual host] with Ipv6.

Francis Daly March 10, 2017 08:38PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 291
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready