Skip to content

Instantly share code, notes, and snippets.

@admench
Last active September 13, 2015 14:50
Show Gist options
  • Save admench/ea180b8e785f4922edcc to your computer and use it in GitHub Desktop.
Save admench/ea180b8e785f4922edcc to your computer and use it in GitHub Desktop.
Pre configured Nginx site for Laravel Forge provisioned servers with www redirect to non-www host to be used for Craft CMS based sites
server {
listen 80;
server_name www.domain;
return 301 $scheme://domain$request_uri;
}
server {
listen 80;
server_name domain;
root /home/forge/domain/public;
# FORGE SSL (DO NOT REMOVE!)
# ssl on;
# ssl_certificate;
# ssl_certificate_key;
index index.html index.php;
charset utf-8;
location ~ ^(.*)$ {
try_files $uri $uri/ /index.php?p=$uri&$args;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
location ~ /\. { access_log off; log_not_found off; deny all; }
location ~* \.(?:ico|css|js|gif|jpe?g|png)$ {
expires max;
add_header Pragma public;
add_header Cache-Control "public, must-revalidate, proxy-revalidate";
}
access_log /var/log/nginx/domain.access.log;
error_log /var/log/nginx/domain.error.log debug;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment