Nginx Configuration Examples

Nginx web server does not support Apache rewrite syntax from Apache's mod_rewrite module. As such, you need to convert your Apache rewrite syntax to Nginx rewrite syntax which uses the HttpRewriteModule. Nginx.org Documentation site has examples for Apache rewrite conversion to Nginx rewrites here.

Centmin Mod doesn't provide any support for converting your Apache rewrites to Nginx rewrites. You will have to figure those out on your own (Google search is a good place to start. As is the linked official Nginx forums below).

However, below are links to compiled lists of Nginx sample configuration settings and Nginx rewrite rules for various apps. As per FAQ, if you would like to share and contribute your working Nginx configuration settings and Nginx rewrite rules with appropriate credit acknowledgement and link back, please contact me or join and share on the Centmin Mod Google+ Community.

If you can't find what you're looking for, check and ask on Nginx's official forums at http://forum.nginx.org/ as well as check out the official Wiki.

  1. Nginx + Cloudflare, Incapsula & Google PageSpeed Service IP addresses (reverse proxy HttpRealIpModule)
  2. ownCloud installation on Nginx (Added May 8th, 2014)
  3. Wordpress Nginx Auto Installer - centmin.sh menu option 22 (Added September 3rd, 2015)
  4. Nginx and Wordpress + WP Super Cache Plugin (Added March 30th, 2014) - recommended Wordpress setup with least issues
  5. Nginx and Wordpress + WP-FFPC Plugin (with ngx_pagespeed) (Added July 19th, 2013).
  6. Nginx and Wordpress (basic, fastcgi cache, and fastcgi_cache + ngx_pagespeed)
  7. Nginx and vBulletin 4.1.x inbuilt Friendly Urls
  8. Nginx rewrites for vBulletin vBSEO
  9. Nginx and Xenforo SEO Friendly Urls
  10. Nginx HTTPS / SSL Google SPDY configuration (Added July 30th, 2013).
  11. Nginx Vhost & Rewrites for IP.Board 3.x & 4.1 (Added August 3rd, 2013 & Updated September 19th, 2016)
  12. Nginx and vBulletin Connect 5 Vhost (Added August 9th, 2013)
  13. Ghost node.js Blog install on Centmin Mod Nginx stack (Added October 28th, 2013)
  14. Laravel 5.1 install on Centmin Mod Nginx stack (Added August 31st, 2015)

Note: /usr/local/nginx/conf/staticfiles.conf include file in each Nginx vhost template has a .html, .htm, txt location context match which may interfere with rewrites of static files, especially if you're using wordpress permalinks that end in .html. Easiest solution is to remove the .html, .htm, .txt location context match in staticfiles.conf include file or choose a permalink format which does not use .html extensions. For more info see here: #35.

    location ~* \.(html|htm|txt)$ {
        #add_header Pragma public;
        add_header Cache-Control "public, must-revalidate, proxy-revalidate";
        access_log off;
        expires 1d;
        break;
        }