I am working on hosting static websites on amazon S3. The structure of the website will be bucket-name / site-name / files.html . Now my problem is that the user can use his own domain to publish the website. For example: he owns a domain such as www.ABC.com and wants to host his site there.
I installed a reverse proxy server on an ec2 instance to proxy requests, that is, one hit www.ABC.com should see the contents from the S3 bucket or the domain name should point to the S3 bucket.
I know there are DNS changes and updates to CNAME and A records, but I also need to write RULES in the NGINX configuration to redirect the URL as I want.
This is a structure that I have, I donβt work, and I would like the experts to watch: I am currently publishing my sites on the sites.development.com/bucket-name/sitename subdomain.
This is my default.conf file after installing nginx.
server { listen xx0.0:80; server_name xxxx; access_log /var/log/nginx/access.log; error_log /var/log/nginx/error.log; root /usr/local/nginx/html; index index.html; location / { proxy_pass http://development.mydomain.com:9585; include /etc/nginx/proxy_params; } }
I am currently installing it on a development server whose URL is http://development.mydomain.com (this is an independent instance of ec2). My proxy server runs on a different instance of EC2 than http://development.mydomain.com .
I came up with some kind of structure based on suggestions from different sources.
It is he:
server { listen 80; server_name xxxx; //This would be the name on which I have NGINX installed,right? set $host_without_www $host; //What would be the host?any host with www pointing to the site on S3? if ($host ~* www\.(.*)) { set $host_without_www $1; } location / { rewrite ^(.*)$ /$host_without_www$1 break; proxy_pass {{s3-bucket-url}}; } }
I have no experience with NGINX and proxies and therefore have been stuck for some time.
Please share comments based on your experience and suggest a solution.
Thanks for attention.
php amazon-s3 amazon-web-services nginx bucket
Killabug
source share