# GitHub configuration files

**URL:** <https://www.ruby-forum.com/t/github-configuration-files/193870>\
**Category:** NGINX\
**Created:** [August 25, 2010, 10:10pm UTC](https://www.ruby-forum.com/t/github-configuration-files/193870 "2010-08-25T22:10:20Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![nofun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/839c29/32.png) [@nofun](https://www.ruby-forum.com/u/nofun)\
**Post date:** [August 25, 2010, 10:10pm UTC](https://www.ruby-forum.com/t/github-configuration-files/193870/1 "2010-08-25T22:10:20Z")

</div>

Hello,

I am trying to put together a set of configuration files, generalized  
for different web applications (for the moment just Drupal and  
WordPress) and with added security. All of them will be modular so that  
they can be interchanged, and also I tried to listen to many advices on  
this forum, like the use of try\_files instead of if, etc. And of course  
this needs to be very simple and general so any custom modifications  
will be excluded, so that the files can be used on any system and  
application. Also, they are made just for NginX and PHP-FPM (or  
FastCGI)

This is available at [http://github.com/vladgh/nginx](http://github.com/vladgh/nginx) and I am open to any  
suggestions that you may have.

I am doing this because for the moment finding a good configuration  
example is very difficult and involves a lot of searching and  
trial&error. Most of them are intended for very specific applications  
and must be heavily customized to get them working. You are welcomed to  
add any comment you might have.

Posted at Nginx Forum:

> **[GitHub configuration files](https://forum.nginx.org/read.php?2,123720,123720#msg-123720)**
>
> Hello, I am trying to put together a set of configuration files, generalized for different web applications (for the moment just Drupal and WordPress) and with added security. All of them will be modular so that they can be interchanged, and also I...

---

<div class="post-metadata">

**Author:** ![nofun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/839c29/32.png) [@nofun](https://www.ruby-forum.com/u/nofun)\
**Post date:** [August 25, 2010, 10:17pm UTC](https://www.ruby-forum.com/t/github-configuration-files/193870/2 "2010-08-25T22:17:57Z")

</div>

I had thought of posting some recipes up at one point as well.

# all other requests go to Wordpress

```
    if (!-e $request_filename) {
      rewrite ^/(.*)$ /index.php?q=$1 last;
      rewrite /(.*)/$ /index.php?q=$1 last;
      break;
    }

```

I don’t think you need that; probably simpler to do try\_files there.

I haven’t used wp supercache; I would make two configs, one for  
wordpress and one for wordpress with wp supercache. Because my default  
wordpress and drupal configs are basically just try\_files lines.

Drupal 6 doesn’t support try\_files, still needs the if (-e) check.  
Drupal 7 works.  
Drupal also has a lot of stuff in the document root to set to  
“internal” sadly. So I have a location block to handle that.

At the moment, this is my working Drupal 6 config:

if (!-e $request\_filename) {  
rewrite ^/(.\*)$ /index.php?q=$1 last;  
}

location ~\*  
.(engine|inc|info|install|module|profile|po|sh|._sql|theme|tpl(.php)?|xtmpl)$|^(code-style.pl|Entries._|Repository|Root|Tag|Template)$  
{  
internal;  
}  
location ~ /sites/all/scripts/.\* { internal; }  
location ~ /sites/all/modules/apachesolr/solrbase/.\* { internal; }

for wordpress:

all you need is:  
try\_files $uri $uri/ /index.php?page=$request\_uri;

see

> **[Front Controller Patterns and nginx](https://michaelshadle.com/2010/08/20/front-controller-patterns-and-nginx)**
>
> It's no secret I'm a fan of nginx. Probably no secret that I'm a fan of front controller pattern design as well. Why? I find it to be the most universal and easy to support. I…

always start out simple, and build from there. 🙂

---

<div class="post-metadata">

**Author:** ![nofun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/839c29/32.png) [@nofun](https://www.ruby-forum.com/u/nofun)\
**Post date:** [August 25, 2010, 10:27pm UTC](https://www.ruby-forum.com/t/github-configuration-files/193870/3 "2010-08-25T22:27:19Z")

</div>

Thank you for the reply, I will make the necessary changes as soon as  
possible. This is exactly why I started this project. Nobody tells you  
this stuff, and the configuration files are scattered all over the  
internet. And this leads to misconfiguration of nginx and thus to  
unsatisfied users. NginX is a great program with great potential and  
should be used accordingly.

Posted at Nginx Forum:

> **[Re: GitHub configuration files](https://forum.nginx.org/read.php?2,123720,123729#msg-123729)**
>
> Hello, I am trying to put together a set of configuration files, generalized for different web applications (for the moment just Drupal and WordPress) and with added security. All of them will be modular so that they can be interchanged, and also I...

---

<div class="post-metadata">

**Author:** ![nofun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/839c29/32.png) [@nofun](https://www.ruby-forum.com/u/nofun)\
**Post date:** [August 26, 2010, 2:42am UTC](https://www.ruby-forum.com/t/github-configuration-files/193870/4 "2010-08-26T02:42:32Z")

</div>

drupal on nginx is pretty much covered in these two conf

> **[GitHub - yhager/nginx\_drupal: nginx configuration for use with Drupal -...](https://github.com/yhager/nginx_drupal)**
>
> nginx configuration for use with Drupal - supports boost, multisite, static image servers and multiple environments - GitHub - yhager/nginx\_drupal: nginx configuration for use with Drupal - support...

[GitHub - omega8cc/boa: Barracuda Octopus Aegir 4.2.0-stable](http://github.com/omega8cc/nginx-for-drupal) Grace updated the repo so  
the actual nginx.conf for drupal is burried in a old commit  
[Aegir with Nginx for Dummies Edition · omega8cc/boa@9e0a964 · GitHub](http://github.com/omega8cc/nginx-for-drupal/commit/9e0a964a986f7b44fbc1b09028b77c160619a8c1#diff-6)

Also, read [Nginx | Drupal Groups](http://groups.drupal.org/nginx)

---

<div class="post-metadata">

**Author:** ![nofun](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/839c29/32.png) [@nofun](https://www.ruby-forum.com/u/nofun)\
**Post date:** [August 26, 2010, 3:25am UTC](https://www.ruby-forum.com/t/github-configuration-files/193870/5 "2010-08-26T03:25:16Z")

</div>

I respect the work of the people you mentioned, and most of the  
configuration I gathered is from both of these sources, but I don’t want  
to limit this to only drupal, or worpdress but also other applications.  
Unlike YHager’s repo I would like to update this with all possible  
security rules and maybe better organize it. On the other hand Grace’s  
configuration is extremely bloated. I don’t really need or afford a  
system with aegir, varnish etc.  
With advices from you I would like to do this very modular, so that when  
someone needs a certain configuration or rules for just a specific  
module, it will be available. That’s why I posted this here, to get  
feedback. I still have a long way, but it will be soon a good reference  
point for a simple nginx machine.

Posted at Nginx Forum:

> **[Re: GitHub configuration files](https://forum.nginx.org/read.php?2,123720,123806#msg-123806)**
>
> Hello, I am trying to put together a set of configuration files, generalized for different web applications (for the moment just Drupal and WordPress) and with added security. All of them will be modular so that they can be interchanged, and also I...
