AWS Beanstalk custom configuration

AWS Beanstalk custom configuration for httpd re-route

include in your war file a folder named '.ebextensions'
in the folder include a file with extension ".config"  eg: myapp.config

myapp.config will contain

container_commands:
    01_setup_rewrite:
        command: "cp .ebextensions/httpd-proxy.conf /etc/httpd/conf.d/httpd-proxy.conf"
    02_apache_restart:
        command: /etc/init.d/httpd restart

This in essence copies the file included in the .ebextnsions folder (httpd-proxy.conf) to the /etc/httpd/conf.d folder.
And restarts httpd

if you look at httpd.conf file it contains an "Include /conf.d/* so anything put on conf.d folder will be included in httpd.conf so essentially you don't need to modify httpd.conf file.

What I do here is redirect all request that comes to the server with /rrrrrr to S3 bucket I configure with the same name as the server.

KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 5
#
# Load mod_proxy modules
#
<IfModule !proxy_module>
LoadModule proxy_module modules/mod_proxy.so
</IfModule>
<IfModule !proxy_http_module>
LoadModule proxy_http_module modules/mod_proxy_http.so
</IfModule>
<Proxy *>
    Order deny,allow
    Allow from all
</Proxy>
ProxyRequests Off
ProxyTimeout 1000
TimeOut 1000

ProxyPass /rrrrrr  http://s3-ap-southeast-2.amazonaws.com
ProxyPassReverse /rrrrrr http://s3-ap-southeast-2.amazonaws.com

Comments

Post a Comment

Popular posts from this blog

API design best practices

DB Connection Issues

Reading Excel Sheet on client side and processing it