.htaccess - Amazon Elastic beanstalk : Use nginx/apache to forward subdomains to subfolders -
i've created node.js app on ebs 2 subrouters 'foo' , 'bar', accessible via 'example.com/foo' , 'example.com/bar'.
i'd reverse proxy of ebs forward subdomains "foo.example.com" , "bar.example.com" these subfolders...
i.e. "foo.example.com/xxx" "example.com/foo/xxx" "bar.example.com/yyy" "example.com/bar/yyy" etc.
i know how configure nginx this, can't figure out access nginx config files on ebs...
someone asked the same thing on year ago, seems ebs has developped deal since... know if sort of thing doable.
you can use configuration file customize nginx configuration.
- create
.ebextensions
directory in top-level of source bundle. - create configuration file,
/your_app/.ebextensions/custom.config
. type following inside configuration file configure forward settings. (i have created gist)
files: "/etc/nginx/conf.d/custom.conf" : content: | server { listen 8080; server_name foo.chief-motp.com; location / { proxy_pass http://nodejs/foo/; proxy_set_header connection ""; proxy_http_version 1.1; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; } location /public { alias /var/app/current/public; } } server { listen 8080; server_name bar.chief-motp.com; location / { proxy_pass http://nodejs/bar/; proxy_set_header connection ""; proxy_http_version 1.1; proxy_set_header host $host; proxy_set_header x-real-ip $remote_addr; proxy_set_header x-forwarded-for $proxy_add_x_forwarded_for; } location /public { alias /var/app/current/public; } }
another methodology customize elastic beanstalk ec2 instances using custom ami. more information, can refer my post.
Comments
Post a Comment