Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
configure httpd for elastic beanstalk
##############################################
#### VHOST file for example.com ####
##############################################
files:
"/etc/httpd/conf.d/www.conf" :
mode: "000644"
owner: root
group: root
content: |
Timeout 600
ProxyTimeout 600
DocumentRoot "/var/app/current/httpdocs"
<Directory "/var/app/current">
AllowOverride All
Require all granted
</Directory>
<Directory "/var/app/current/cgi-bin">
AllowOverride All
Options None
Require all granted
</Directory>
<Directory "/var/app/current/httpdocs">
Options FollowSymLinks
AllowOverride All
DirectoryIndex index.html index.php
Require all granted
</Directory>
<VirtualHost *:8080>
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster@example.com.org
RewriteEngine On
RewriteCond %{HTTP_HOST} ^example.com
RewriteRule ^(.*)$ http://www.example.com%{REQUEST_URI} [R=301,L]
<IfModule php5_module>
php_value newrelic.appname "example.com"
</IfModule>
</VirtualHost>
"/etc/httpd/conf.d/caching.conf":
mode: "000644"
owner: root
group: root
content: |
# Prevent issues of fonts not loading between http and https due to "cross-site access not allowed source"
<FilesMatch "\.(ttf|otf|eot|woff|woff2)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
<filesMatch ".(ico|pdf|flv|jpg|jpeg|png|gif|svg|js|css|swf)$">
Header set Cache-Control "max-age=84600, public"
</filesMatch>
## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 month"
ExpiresByType image/jpeg "access 1 month"
ExpiresByType image/gif "access 1 month"
ExpiresByType image/png "access 1 month"
ExpiresByType image/x-icon "access 1 month"
ExpiresByType image/ico "access plus 1 month"
ExpiresByType text/css "access 6 hours"
ExpiresByType text/css "now plus 1 month"
ExpiresByType text/javascript "access 1 month"
ExpiresByType application/javascript "access plus 1 month"
ExpiresByType text/html "access plus 600 seconds"
</IfModule>
## EXPIRES CACHING ##
"/etc/httpd/conf.d/deflate.conf":
mode: "000644"
owner: root
group: root
content: |
LoadModule deflate_module modules/mod_deflate.so
SetOutputFilter DEFLATE
# mod_deflate configuration
<IfModule mod_deflate.c>
# Restrict compression to these MIME types
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xml+rss
AddOutputFilterByType DEFLATE application/x-javascript
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE text/css
<IfModule mod_headers.c>
# Make sure proxies don't deliver the wrong content
Header append Vary User-Agent env=!dont-vary
</IfModule>
</IfModule>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.