-
-
Save Martin91/762ddfc3072c7e8454de to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<VirtualHost *:80> | |
ServerName example.com | |
ServerAlias *.example.com | |
DocumentRoot /rails_app_directory/public | |
# Redirect all requests that don't match a file on disk under DocumentRoot get proxied to Puma | |
RewriteEngine On | |
<Proxy balancer://unicornservers> | |
BalancerMember http://127.0.0.1:5100 | |
</Proxy> | |
# RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !-f | |
# RewriteRule ^/(.*)$ balancer://unicornservers%{REQUEST_URI} [P,QSA,L] | |
ProxyPass /assets ! | |
ProxyPass / balancer://unicornservers/ | |
ProxyPassReverse / balancer://unicornservers/ | |
ProxyPreserveHost on | |
<Proxy *> | |
Order deny,allow | |
Allow from all | |
</Proxy> | |
# Don't allow client to fool Puma into thinking connection is secure | |
RequestHeader unset X-Forwarded-Proto | |
# Anything under public is open to the world | |
<Directory /home/deploy/apps/zuqiutuan_production/current/public> | |
Require all granted | |
Options -MultiViews | |
Satisfy Any | |
AuthType None | |
</Directory> | |
# Disable ETags (https://github.com/h5bp/server-configs-apache/tree/master/doc#configure-etags) | |
# Set Expiration date for all assets to one year in the future | |
<LocationMatch "^/assets/.*$"> | |
Header unset ETag | |
FileETag None | |
ExpiresActive On | |
ExpiresDefault "access plus 1 year" | |
</LocationMatch> | |
# Rewrite requests for js and css to gzipped versions if client and server support it | |
#<LocationMatch "^/assets/.*\.(css|js)$"> | |
#RewriteEngine on | |
#RewriteCond %{HTTP:Accept-Encoding} \b(x-)?gzip\b | |
#RewriteCond %{REQUEST_FILENAME}.gz -s | |
#RewriteRule ^(.+)$ $1.gz | |
#</LocationMatch> | |
# Set type and headers for gzipped css | |
<LocationMatch "^/assets/.*\.css\.gz$"> | |
ForceType text/css | |
Header set Content-Encoding gzip | |
Header add Vary Accept-Encoding | |
</LocationMatch> | |
# Set type and headers for gzipped js | |
<LocationMatch "^/assets/.*\.js\.gz$"> | |
ForceType application/javascript | |
Header set Content-Encoding gzip | |
Header add Vary Accept-Encoding | |
</LocationMatch> | |
# Compress HTML on the fly | |
AddOutputFilterByType DEFLATE text/html | |
</VirtualHost> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment