Welcome! Log In Create A New Profile

Advanced

Help with nginx running on AWS Fargate and hitting an S3 Website bucket

Anonymous User
October 13, 2019 07:08PM
Hi:

I am having a lot of issues attempting to run NGINX on Fargate whereby I am getting a 502 bad gateway error when hitting
My listener that should be doing a proxy-pass to an S3 website bucket that I created.
I am not sure if this is due to NGINX being unable to do the nameserver resolving even though
I have specified a resolver at both the server level and at the listener level. Neither of which work. ( using googles public nameserver: 8.8.8.8)
Also, I used the standard docker image for NGINX obtained from the NGINX website.
The S3 website bucket is public also just to mention and is serving up the site without issues.


This is the error that I get:

<< Actual hostnames removed for privacy concerns>>
2019/10/12 17:30:45 [error] 7#7: 3 somebucket.s3-website-eu-west-1.amazonaws.com could not be resolved (110: Operation timed out), client: 198.179.137..213, server: somehost@somewhere.com<mailto:somehost@somewhere.com>, request: "GET /login/ HTTP/1.1", host: somehost@somewhere.com<mailto:somehost@somewhere.com>


If anyone has a successful example of running NGINX on Fargate and hitting and S3 website, please let me know.


Thanks,
Alan



Here is my nginx.conf file:

user nginx;
worker_processes 1;


error_log /dev/stdout debug;
pid /var/run/nginx.pid;


events {
worker_connections 1024;
}



http {

server_names_hash_bucket_size 256;
server_names_hash_max_size 512;

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 /dev/stdout main;

sendfile on;
#tcp_nopush on;

keepalive_timeout 65;


#gzip on;

include /etc/nginx/conf.d/*.conf;

index index.html;

server {
listen 80;
server_name *.someserver@somewhere.com<mailto:*.someserver@somewhere.com>;
access_log /dev/stdout;
error_log /dev/stdout;


location /login/ {
resolver 8.8.8.8;

set $bucket "somebucket.s3-website-eu-west-1.amazonaws.com";


rewrite ^([^.]*[^/])$ $1/ permanent;

proxy_pass http://$bucket;


proxy_redirect off;
proxy_set_header Host $bucket;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_hide_header x-amz-id-2;
proxy_hide_header x-amz-request-id;


}
}

}

________________________________

This e-mail is for the sole use of the intended recipient and contains information that may be privileged and/or confidential. If you are not an intended recipient, please notify the sender by return e-mail and delete this e-mail and any attachments. Certain required legal entity disclosures can be accessed on our website.https://www.refinitiv.com/
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Help with nginx running on AWS Fargate and hitting an S3 Website bucket

Anonymous User 59 October 13, 2019 07:08PM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 96
Record Number of Users: 6 on February 13, 2018
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready