Help with nginx running on AWS Fargate and hitting an S3 Website bucket
Alan.Andrea at refinitiv.com
Alan.Andrea at refinitiv.com
Sun Oct 13 23:06:42 UTC 2019
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 at somewhere.com<mailto:somehost at somewhere.com>, request: "GET /login/ HTTP/1.1", host: somehost at somewhere.com<mailto:somehost at 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 at somewhere.com<mailto:*.someserver at 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/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.nginx.org/pipermail/nginx-devel/attachments/20191013/0e84fc0c/attachment.htm>
More information about the nginx-devel
mailing list