Skip to content

Commit

Permalink
Add Pagespeed block (commented out) to nginx config file
Browse files Browse the repository at this point in the history
  • Loading branch information
alexweissman committed Aug 9, 2017
1 parent 8f3a40d commit 1a941c1
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 10 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
- Reimplement `Builder::exclude` to maintain a list of excluded columns, and then automatically update list of columns to fetch in `get()`
- Deprecate `Model::queryBuilder` and `Model::export`
- Update nginx config file from spdy to http2
- Add Pagespeed block (commented out) to nginx config file
- Make fpm-php7.0 the default CGI nginx config file

## v4.1.7-alpha
- Add the `withTernary` method to the `Unique` trait to allow loading nested child models on ternary relationships.
Expand Down
39 changes: 29 additions & 10 deletions webserver-configs/nginx.conf
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
## This is just a starting point for configuring your application. It is not guaranteed to work out of the box.
## See https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/
## UserFrosting sample nginx configuration file.
## See https://learn.userfrosting.com/going-live/vps-production-environment/application-setup#configure-the-webserver-nginx-

## Redirect HTTP to HTTPS
## Enable this block once you've set up SSL. This will redirect all HTTP requests to HTTPS.
Expand All @@ -9,8 +9,7 @@
# return 301 https://$host$request_uri;
#}

# Default server configuration
#
## Main server configuration
server {
## Non-SSL configuration. Not recommended for production!
listen 80;
Expand Down Expand Up @@ -50,6 +49,7 @@ server {
#ssl_trusted_certificate /etc/letsencrypt/live/<cert name>/fullchain.pem; # same as your ssl_certificate path
## Config to enable HSTS(HTTP Strict Transport Security) https://developer.mozilla.org/en-US/docs/Security/HTTP_Strict_Transport_Security
#add_header Strict-Transport-Security "max-age=31536000; includeSubdomains;";
## End - SSL configuration

access_log /var/log/nginx/access.log;

Expand All @@ -58,12 +58,29 @@ server {
## This header enables the Cross-site scripting (XSS) filter built into most recent web browsers.
add_header X-XSS-Protection "1; mode=block"; #optional

# Allow URLs for certbot acme challenge (Let's Encrypt)
## Begin - Pagespeed
## See https://learn.userfrosting.com/going-live/vps-production-environment/additional-recommendations
## for information on compiling nginx with the Pagespeed module.
#pagespeed on;
#pagespeed FileCachePath /var/ngx_pagespeed_cache;
#pagespeed Disallow "*.svg*";
## Add additional filters here
#pagespeed EnableFilters prioritize_critical_css;
## Ensure requests for pagespeed optimized resources go to the pagespeed
## handler and no extraneous headers get set.
#location ~ "\.pagespeed\.([a-z]\.)?[a-z]{2}\.[^.]{10}\.[^.]+" { add_header "" ""; }
#location ~ "^/ngx_pagespeed_static/" { }
#location ~ "^/ngx_pagespeed_beacon" { }
## End - Pagespeed

## Begin - Let's Encrypt
## Allow URLs for certbot acme challenge
location ~ /.well-known {
allow all;
}
## End - Let's Encrypt

## handle php requests.
## Begin - Handle PHP requests
location ~ \.(php)$ {
# Throw away any requests to execute PHP scripts in other directories
# See http://cnedelcu.blogspot.com/2010/05/nginx-php-via-fastcgi-important.html for why this is needed
Expand All @@ -73,10 +90,10 @@ server {
# regex to split $uri to $fastcgi_script_name and $fastcgi_path
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_keep_conn on;
# For FPM (PHP 5.x)
fastcgi_pass unix:/var/run/php5-fpm.sock;
# For FPM (PHP 7)
#fastcgi_pass unix:/run/php/php7.0-fpm.sock;
fastcgi_pass unix:/run/php/php7.0-fpm.sock;
# For FPM (PHP 5.x)
#fastcgi_pass unix:/var/run/php5-fpm.sock;
# For traditional PHP FastCGI (php5-cgi or php7.0-cgi)
#fastcgi_pass 127.0.0.1:9000;
# For HHVM
Expand All @@ -85,15 +102,17 @@ server {
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
## End - Handle PHP requests

## we can cache some static files
## Begin - Caching static files
location ~* \.(png|gif|jpg|jpeg|svg|ico|css|js|woff|ttf|otf|woff2|eot)$ {
include /etc/nginx/mime.types;
expires max;

index index.php;
try_files $uri $uri/ /index.php?$query_string;
}
## End - Caching static files

## Begin - Index
## for subfolders, simply adjust:
Expand Down

0 comments on commit 1a941c1

Please sign in to comment.