Skip to content

@d3vkit /gist:8a4dcd6a75f331fd94e9 secret

Embed URL


Subversion checkout URL

You can clone with
Download ZIP
Wordpress NGINX Conf
# You can see where I commented out the passenger stuff I had before.
server {
listen 80;
index index.php index.html index.htm;
root /var/www/website/public;
access_log /var/www/website/log/access.log;
error_log /var/www/website/log/error.log;
# Use gzip compression
# gzip_static on; # Uncomment if you compiled Nginx using --with-http_gzip_static_module
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;
# 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';
# Deny access to hidden files
location ~* /\.ht {
deny all;
access_log off;
log_not_found off;
try_files $uri $uri/ /index.php;
# Use rails app inside wordpress
location /portal {
root /var/www/portal/public;
# rails_env development;
# passenger_min_instances 2;
# passenger_enabled on;
# passenger_base_uri /portal;
# Pass PHP scripts on to PHP-FPM
location ~* \.php$ {
include /usr/local/nginx/conf/fastcgi_params;
fastcgi_index index.php;
fastcgi_pass unix:/var/run/php5-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
# passenger_pre_start;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.