Skip to content

Commit

Permalink
Refactor project template
Browse files Browse the repository at this point in the history
  • Loading branch information
mchung committed Feb 8, 2013
1 parent 3637926 commit 920ecbf
Show file tree
Hide file tree
Showing 154 changed files with 191 additions and 157 deletions.
18 changes: 17 additions & 1 deletion README.markdown
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
# Wordpress on Heroku

For everything you ever wanted to know about running Wordpress on Heroku, check out my [heroku-buildpack-wordpress](http://github.com/mchung/heroku-buildpack-wordpress)
This is where changes to your Wordpress site are made. Changes committed to this directory will overwrite all the vendor defaults.

Generally, you'll be interested in adding plugins, adding themes, and modifying wordpress.conf.erb.
```
└── config # Config files
├── public # Public directory
│   └── wp-content # Themes & plugins
│   ├── plugins
│   └── themes
└── vendor # Config files for vendored apps
├── nginx
│   └── conf # nginx.conf + wordpress.conf.erb
└── php # php.ini
└── etc # php-fpm.conf
```

For everything you ever wanted to know about running Wordpress on Heroku, check out my [heroku-buildpack-wordpress](http://github.com/mchung/heroku-buildpack-wordpress).
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
58 changes: 58 additions & 0 deletions config/vendor/nginx/conf/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
# setting worker_processes to CPU core count
worker_processes 1;
daemon off;

events {
worker_connections 1024;
use epoll;

# Accept as many connections as possible.
multi_accept on;
}

http {
include mime.types;
default_type application/octet-stream;

sendfile on;
port_in_redirect off;

# timeouts
client_body_timeout 60;
client_header_timeout 60;
keepalive_timeout 65;
send_timeout 60;

# server
root /app/public;
index index.php;

# Use gzip compression
gzip_static on;
gzip on;
gzip_disable "msie6";
gzip_vary on;
gzip_proxied any;
gzip_comp_level 5;
gzip_buffers 16 8k;
gzip_http_version 1.0;
gzip_types text/plain text/css application/json application/x-javascript text/xml application/xml application/xml+rss text/javascript image/png image/gif image/jpeg;

# Latest https://www.cloudflare.com/ips-v4
set_real_ip_from 204.93.240.0/24;
set_real_ip_from 204.93.177.0/24;
set_real_ip_from 199.27.128.0/21;
set_real_ip_from 173.245.48.0/20;
set_real_ip_from 103.21.244.0/22;
set_real_ip_from 103.22.200.0/22;
set_real_ip_from 103.31.4.0/22;
set_real_ip_from 141.101.64.0/18;
set_real_ip_from 108.162.192.0/18;
set_real_ip_from 190.93.240.0/20;
set_real_ip_from 188.114.96.0/20;
set_real_ip_from 197.234.240.0/22;
set_real_ip_from 198.41.128.0/17;
real_ip_header X-Forwarded-For;

include wordpress.conf;
}
116 changes: 116 additions & 0 deletions config/vendor/nginx/conf/wordpress.conf.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
server {
server_name localhost;
listen <%= ENV['PORT'] %>;

# Some basic cache-control for static files to be sent to the browser
location ~ \.(html|htm|rtf|rtx|svg|svgz|txt|xsd|xsl|xml)$ {
try_files $uri =404;
expires 86000s;
add_header Pragma "public";
add_header Cache-Control "max-age=86000, public, must-revalidate, proxy-revalidate";
}

location ~ \.(css|js|htc)$ {
try_files $uri =404;
expires max;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
access_log off;
}

location ~ \.(asf|asx|wax|wmv|wmx|avi|bmp|class|divx|doc|docx|eot|exe|gif|gz|gzip|ico|jpg|jpeg|jpe|mdb|mid|midi|mov|qt|mp3|m4a|mp4|m4v|mpeg|mpg|mpe|mpp|otf|odb|odc|odf|odg|odp|ods|odt|ogg|pdf|png|pot|pps|ppt|pptx|ra|ram|svg|svgz|swf|tar|tif|tiff|ttf|ttc|wav|wma|wri|xla|xls|xlsx|xlt|xlw|zip)$ {
try_files $uri =404;
expires max;
add_header Pragma "public";
add_header Cache-Control "max-age=31536000, public, must-revalidate, proxy-revalidate";
access_log off;
}

# Deny hidden files (.htaccess, .htpasswd, .DS_Store).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}

# Deny /favicon.ico
location = /favicon.ico {
access_log off;
log_not_found off;
}

# Deny /robots.txt
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}

# PHP status. /status.html uses /status
location ~ ^/(status|ping)$ {
include /app/vendor/nginx/conf/fastcgi_params;
fastcgi_pass unix:/tmp/php-fpm.socket;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}

# Nginx status. http://wiki.nginx.org/HttpStubStatusModule
# location /nginx_status {
# # copied from http://blog.kovyrin.net/2006/04/29/monitoring-nginx-with-rrdtool/
# stub_status on;
# access_log off;
# allow SOME.IP.ADD.RESS;
# deny all;
# }

# Set a variable to work around the lack of nested conditionals
set $cache_uri $request_uri;

# POST requests and urls with a query string should always go to PHP
if ($request_method = POST) {
set $cache_uri 'no cache';
}

if ($query_string != "") {
set $cache_uri 'no cache';
}

# Don't cache uris containing the following segments
# if ($request_uri ~* "(\/wp-admin\/|\/xmlrpc.php|\/wp-(app|cron|login|register|mail)\.php|wp-.*\.php|index\.php|wp\-comments\-popup\.php|wp\-links\-opml\.php|wp\-locations\.php)") {
# set $cache_uri "no cache";
# }

# Don't use the cache for logged in users or recent commenters
if ($http_cookie ~* "comment_author|wordpress_[a-f0-9]+|wp\-postpass|wordpress_logged_in") {
set $cache_uri 'no cache';
}

# Enable clickjacking protection
add_header X-Frame-Options SAMEORIGIN;

# X-Powered-By Wordpress on Heroku
add_header X-Powered-By "Wordpress on Heroku http://git.io/SAoKQQ";

location / {
# wordpress fancy rewrites
if (-f $request_filename) {
break;
}

if (-d $request_filename) {
break;
}

rewrite ^(.+)$ /index.php?q=$1 last;

# redirect to feedburner.
# if ($http_user_agent !~ FeedBurner) {
# rewrite ^/feed/?$ http://feeds.feedburner.com/feedburner-feed-id last;
# }
}

location ~ .*\.php$ {
include /app/vendor/nginx/conf/fastcgi_params;
fastcgi_pass unix:/tmp/php-fpm.socket;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
}
File renamed without changes.
File renamed without changes.
156 changes: 0 additions & 156 deletions setup/nginx.conf.erb

This file was deleted.

0 comments on commit 920ecbf

Please sign in to comment.