Skip to content

Instantly share code, notes, and snippets.

@kiasaki
Last active August 29, 2015 14:03
Show Gist options
  • Save kiasaki/f72fc18e76352a7e49bc to your computer and use it in GitHub Desktop.
Save kiasaki/f72fc18e76352a7e49bc to your computer and use it in GitHub Desktop.
server {
listen 80;
server_name <fqdn>;
rewrite ^ https://$server_name$request_uri? permanent;
error_log /var/log/nginx/<app>-error.log;
access_log /var/log/nginx/<app>-access.log;
}
server {
listen 443;
server_name <fqdn>;
root /var/www/<app>/current/public;
index index.php index.html;
ssl on;
ssl_certificate /etc/nginx/ssl/<app>.crt;
ssl_certificate_key /etc/nginx/ssl/<app>.key;
error_log /var/log/nginx/<app>-error.log;
access_log /var/log/nginx/<app>-access.log;
location / {
try_files $uri $uri/ index.php?$query_string;
}
error_page 404 /404.html;
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/www;
}
location ~ \.php$ {
try_files $uri /index.php =404;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment