Nginx request giving ERR_INCOMPLETE_CHUNKED_ENCODING while try to connect - nginx

I have configured my nginx config file in /etc/nginx/sites-enabled
filename:- subdomain.xyz
But When I am using proxy_pass in location directive it is giving me ERR_INCOMPLETE_CHUNKED_ENCODING in chrome browser.
My config file:-
server {
listen 443 ssl default_server;
listen [::]:443 ssl default_server;
server_name subdomain_name;
include /etc/nginx/snippets/ssl;
location / {
proxy_pass http://ip_address:port_number/services;
}
}
Can anyone help me on this.
Thankyou in advance

I have solved this problem using add proxy_hadder in nginx config file

Related

Change port for http to https -- Nginx

Sorry for limited understanding on Nginx, Iam new to Nginx.
I have a webapp running on React and Nginx. Recently I received the SSL certificates for my website. I tried to configure the website and it worked partially. The problem is when I tried to open "https://example.com", the SSL certificates are visible here but its showing nginx default home page. While when I open "http://example.com" it shows all the webcontent.
I attempted to:
change the port from 80 to 443
Reinstall nginx.
But nothing seems to work. Here is my nginx confs at the moment:
/etc/nginx/sites-available/example.org
server {
listen 443;
listen [::]:443;
ssl on;
ssl_certificate /etc/nginx/ssl/bundle.cer;
ssl_certificate_key /etc/nginx/ssl/example.key
root /var/www/html;
server_name example.org;
location / {
try_files $uri $uri/ =404;
}
}
server {
listen 80;
listen [::]:80;
server_name _;
return 301 https://example.org;
}
/etc/nginx/conf.d/www/example.org.conf
server {
listen 80 default_server;
server www.example.org;
location / {
root /usr/share/nginx/html;
index index.htm; index.html;
}
}
Note: I reload nginx at every new attempt.
Please help where am I going wrong.
Keeping just 1 file for config works for the above problem. I kept the "default" conf at "/etc/nginx/sites-available"

How CDN knows which Edge sever should it redirect the client to?

I'm trying to learn more about how CDN works. How does it knows which Edge sever should it redirect the client to for lowest latency? Thank you.
For this purpose, Upstream configuration is used in Nginx webserver.
nginx redirect users's requests to the destination server.
sample of Nginx upstream is as bellow.
upstream example.com {
server example.com;
}
server {
listen 443 ssl http2;
listen [::]:443 ssl http2;
access_log /var/log/nginx/access.log custom;
location / {
proxy_pass http://example.com;
}

how a single ip mapped to multiple domain names?

I am facing an issue while working on a project. For example i had a ubuntu running with nginx configuration. I had configure wildcard with nginx like:-
main domain : xyz.com
wildcard : a.xyz.com, b.xyz.com working.
The above config is working with https with the help of let encrypt.
Here is my problem, that i am facing right now.
I want that if i give someone a.xyz.com, and then that someone want that a.xyz.com will listen that www.someone.com. Is that possible or not this is the question i am lokking into and if yes then please suggest how??
And if you think question header is nothing to do with my question then let me clear that the same issue i am facing shopify guys are doing some how.
Thanks for your precious time.
You can below configuration
server {
listen 80;
listen 443 ssl;
server_name a.xyz.com;
ssl_certificate /path/to/cert/YourCert.pem;
ssl_certificate_key /path/to/cert/privkey.pem;
location / {
proxy_pass https://www.someone.com;
}
}
server {
listen 80;
listen 443 ssl;
server_name b.xyz.com;
ssl_certificate /path/to/cert/YourCert.pem;
ssl_certificate_key /path/to/cert/privkey.pem;
location / {
proxy_pass https://www.someone2.com;
}
}

Nginx server block ERR_NAME_NOT_RESOLVED

I am running Nginx on an Ubuntu 14.04.5 server. I am trying to set up a new server block but when I navigate to the URL I see this error:
My configuration for this virtual host is below.
The directory that I'd like my subdomain to point to is /var/www/vhosts/ny-video.splashpreviews.com
In /etc/nginx/sites-available is my server block file. The server configuration part of that file is below:
server {
listen *:80;
listen [::]:80;
root /var/www/vhosts/ny-video.splashpreviews.com;
index index.php index.html index.htm;
# Make site accessible from http://localhost/
server_name ny-video.splashpreviews.com;
}
I then enabled the server block and restarted Nginx. Is there something I am missing in the process or something I am doing wrong that is causing this to not work? Any guidance would be appreciated. Thank you.
You need to add splashpreviews.com site to configuration and allow locations of the server. There can be several location sections, limiting access to each subdirectory.
http {
limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;
include /etc/nginx/mime.types;
....
server {
listen 80;
server_name splashpreviews.com www.splashpreviews.com;
location / {
allow all;
}
....
}
server {
listen 80;
server_name ny-video.sp.com;
location / {
allow all;
}

nginx matching wildcard subdomains without me asking to do this

I have the following server block
server{
listen 80;
server_name foo.domain.com;
root /some/rails/app;
passenger_enabled on;
}
However any subdomain under domain.com is matched using this block and is served by my rails app, so a.domain.com, nothing.domain.com, all are being sent to the rails app, how can I prevent this wildcard behavior which I didn't ask for ?
You can drop all traffics that wasn't to a domain explicitly defined in another server configurations
server {
listen 80 default_server;
server_name _;
deny all;
}

Resources