Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nginx Optimization #766

Open
raamdev opened this issue May 12, 2016 · 1 comment
Open

Nginx Optimization #766

raamdev opened this issue May 12, 2016 · 1 comment

Comments

@raamdev
Copy link
Contributor

raamdev commented May 12, 2016

It would be nice to have a panel for Nginx Optimization that provides Apache-equivalents for the .htaccess tweaks provided in the upcoming Apache Optimization panel.

Since we can't auto-insert things into the Nginx configuration files, this should simply be a list of configuration samples organized by type of optimization (GZIP, Leverage Browser Caching, etc.).

This panel should always be visible, but the contents of it should grey out with a note at the top indicating that Nginx was not detected.

@jaswrks
Copy link

jaswrks commented Jun 27, 2016

Suggested Nginx Configuration Snippets

# CORS headers.
# Add these to the `http{}` block, or a `server{}` block.

map $uri $_access_control_allow_origin {
  default '';
  ~*\.(?:otf|ttf|woff|woff2|eot)$ '*';
}
add_header access-control-allow-origin $_access_control_allow_origin always;
# Leverage browser cache.
# Add these to the `http{}` block, or a `server{}` block.

if_modified_since exact;
etag on; # See: <http://jas.xyz/1MzvnWz>

map $uri $_expires {
  default 5d;
  ~*[^/]\.php(?:/|$) off;
}
expires $_expires;
# GZIP compression for compressable MIME types.
# Add these to the `http{}` block, or a `server{}` block.

gzip on;
gzip_vary on;
gzip_comp_level 6;

gzip_types text/xml text/plain # text/html (already implied)
  image/svg+xml application/rss+xml application/atom+xml application/xhtml+xml
  text/css application/json application/javascript application/x-php-source
  application/font-otf application/font-ttf;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants