Skip to content

Instantly share code, notes, and snippets.

@expertjtb
Created March 9, 2017 14:18
Show Gist options
  • Save expertjtb/62dd52f6e9f40a4623b7755c2c2d764f to your computer and use it in GitHub Desktop.
Save expertjtb/62dd52f6e9f40a4623b7755c2c2d764f to your computer and use it in GitHub Desktop.
##
# You should look at the following URLs in order to grasp a solid understanding
# of Nginx configuration files in order to fully unleash the power of Nginx.
# http://wiki.nginx.org/Pitfalls
# http://wiki.nginx.org/QuickStart
# http://wiki.nginx.org/Configuration
#
# Generally, you will want to move this file somewhere, and start with a clean
# file but keep this around for reference. Or just disable in sites-enabled.
#
# Please see /usr/share/doc/nginx-doc/examples/ for more detailed examples.
##
server {
listen 8080; #C9 limits public ports. Only 8080 available
## REPLACE BELOW WITH YOUR ACTUAL SERVER NAME:
# server_name *.c9users.io;
# see live server example below
##
server_name imperial-expertjtb.c9users.io;
# Home directoy, our server workspace
root /home/ubuntu/workspace;
# Look for index files in this order
index index.html index.htm index.php;
# You know, weird things always happening around symbols.
charset utf-8;
# Allow to upload more buffer
client_max_body_size 32M;
# Only one location is needed. The root.
location / {
# Default: Parameters at the end for rewriting.
# try_files $uri $uri/ /index.php?$query_string;
# Query modified for Drupal, althought should work without it.
# this try_files (Note "q" parameter)
# try_files $uri $uri/ /index.php?q=$uri&$args;
# Yet another default
try_files $uri $uri/ /index.php$is_args$args;
}
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 /home/ubuntu/error.log notice;
error_page 404 /index.php;
# PHP-FPM setup.
location ~ \.php$ {
fastcgi_split_path_info ^(.+\.php)(/.+)$;
# We love socks, no callbacks.
fastcgi_pass unix:/var/run/php/php7.0-fpm.sock;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
include fastcgi_params;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment