Skip to content

Instantly share code, notes, and snippets.

@Rjs37
Last active October 12, 2017 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Rjs37/d8f606d6d5916e3588de to your computer and use it in GitHub Desktop.
Save Rjs37/d8f606d6d5916e3588de to your computer and use it in GitHub Desktop.
[Custom Nginx Config for SSL sites in Forge] Customised Nginx config for an SSL based website in Forge #server
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/website.com/before/*;
server {
listen 443 ssl;
server_name website.com;
root /home/forge/website.com/public;
# FORGE SSL (DO NOT REMOVE!)
ssl_certificate /etc/nginx/ssl/website.com/1234/server.crt;
ssl_certificate_key /etc/nginx/ssl/website.com/1234/server.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
index index.html index.htm index.php;
# CloudFlare
include /etc/nginx/_include/cloudflare;
charset utf-8;
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/website.com/server/*;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
# Remove trailing slash to please routing system.
if (!-d $request_filename) {
rewrite ^/(.+)/$ /$1 permanent;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
access_log off;
error_log /var/log/nginx/dev.egl.tv-error.log error;
error_page 404 /index.php;
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_index index.php;
include fastcgi_params;
}
location ~ /\.ht {
deny all;
}
}
# FORGE CONFIG (DOT NOT REMOVE!)
include forge-conf/website.com/after/*;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment