-
-
Save Hadryan/d7af17750b2bf590741fc6cf2b6ed6fa to your computer and use it in GitHub Desktop.
Sample for Nginx settings on Openshift
This file contains 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
# Enable Gzip | |
gzip on; | |
gzip_http_version 1.0; | |
gzip_comp_level 2; | |
gzip_min_length 1100; | |
gzip_buffers 4 8k; | |
gzip_proxied any; | |
gzip_types | |
text/css | |
text/javascript | |
text/xml | |
text/plain | |
text/x-component | |
application/javascript | |
application/json | |
application/xml | |
application/rss+xml | |
font/truetype | |
font/opentype | |
application/vnd.ms-fontobject | |
image/svg+xml; | |
gzip_static on; | |
gzip_proxied expired no-cache no-store private auth; | |
gzip_disable "MSIE [1-6]\."; | |
gzip_vary on; | |
server { | |
listen <%= ENV['OPENSHIFT_NGINX_IP'] %>:<%= ENV['OPENSHIFT_NGINX_PORT'] %>; | |
server_name <%= ENV['OPENSHIFT_APP_DNS'] %>; | |
root <%= ENV['OPENSHIFT_REPO_DIR'] %>/public; | |
add_header Strict-Transport-Security max-age=691200; | |
location / { | |
index index.html index.htm index.php ; | |
try_files $uri $uri/ @rewrites; | |
} | |
location = /robots.txt { access_log off; log_not_found off; } | |
location ~ /\. { access_log off; log_not_found off; deny all; } | |
location ~ ~$ { access_log off; log_not_found off; deny all; } | |
# Set expires max on static file types | |
location ~* ^.+\.(css|js|jpg|jpeg|gif|png|ico|gz|svg|svgz|ttf|otf|woff|eot|mp4|ogg|ogv|webm)$ { | |
access_log off; | |
log_not_found off; | |
# Some basic cache-control for static files to be sent to the browser | |
expires max; | |
add_header Pragma public; | |
add_header Cache-Control "public, must-revalidate, proxy-revalidate"; | |
} | |
location @rewrites { | |
rewrite ^(.*)$ /index.php/$1 last; | |
} | |
# pass the PHP scripts to PHP-FPM | |
# for only index.php requests, change next line 'location' for commented line below | |
location ~ ^/index\.php(/|$) { | |
fastcgi_pass unix:<%= ENV['OPENSHIFT_PHP_SOCKET'] %>; | |
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; | |
fastcgi_param PATH_INFO $fastcgi_script_name; | |
include <%= ENV['OPENSHIFT_NGINX_DIR'] %>/usr/nginx-<%= ENV['OPENSHIFT_NGINX_VERSION'] %>/conf/fastcgi_params; | |
} | |
} | |
# opt-in to the future | |
add_header "X-UA-Compatible" "IE=Edge,chrome=1"; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment