# 403 Forbidden error with Mediawiki

**URL:** <https://www.ruby-forum.com/t/403-forbidden-error-with-mediawiki/228806>\
**Category:** NGINX\
**Created:** [May 8, 2013, 2:06pm UTC](https://www.ruby-forum.com/t/403-forbidden-error-with-mediawiki/228806 "2013-05-08T14:06:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Stylw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bc79bd/32.png) [@Stylw](https://www.ruby-forum.com/u/Stylw)\
**Post date:** [May 8, 2013, 2:06pm UTC](https://www.ruby-forum.com/t/403-forbidden-error-with-mediawiki/228806/1 "2013-05-08T14:06:59Z")

</div>

I’m having a frustrating experience trying to get nginx to work properly  
with mediawiki’s pretty urls. For some reason my configuration won’t  
detect  
that my mediawiki installation is installed in a folder above root (said  
folder is called /w/) and appears to be throwing out 403 forbidden  
errors  
when trying to access my site.

The script itself works properly, and I have no problem with accessing  
the  
wiki installation my using [mydomain.com/w/](http://mydomain.com/w/) - but if I don’t manually  
input  
that /w/ folder in the website address nginx will throw a 403 forbidden  
error at me. I should also mention that root is empty apart from that  
folder, which is why I suspect nginx is throwing that 403 message at me.

I don’t want to flood people’s emails with my giant nginx configuration,  
so  
I’ll include links to a pastebin dump which has them. I’ve also removed  
any  
personal information which could hint at where my site is hosted and/or  
what  
the domain is.

Nginx error log: [http://pastebin.com/BZGWurYZ](http://pastebin.com/BZGWurYZ)  
Niginx configuration: [http://pastebin.com/mFdHbEzm](http://pastebin.com/mFdHbEzm)  
Mediawiki settings: [http://pastebin.com/nQuaZBdQ](http://pastebin.com/nQuaZBdQ)

I hope somebody can figure out where the fault is - I’ve been ripping  
out my  
hair over it.

Posted at Nginx Forum:

> **[403 Forbidden error with Mediawiki](https://forum.nginx.org/read.php?2,239004,239004#msg-239004)**
>
> I'm having a frustrating experience trying to get nginx to work properly with mediawiki's pretty urls. For some reason my configuration won’t detect that my mediawiki installation is installed in a folder above root (said folder is called /w/) and...

---

<div class="post-metadata">

**Author:** ![Stylw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bc79bd/32.png) [@Stylw](https://www.ruby-forum.com/u/Stylw)\
**Post date:** [May 8, 2013, 2:34pm UTC](https://www.ruby-forum.com/t/403-forbidden-error-with-mediawiki/228806/2 "2013-05-08T14:34:28Z")

</div>

Why would Nginx automatically redirect [mydomain.com](http://mydomain.com) do [mydomain.com/w/](http://mydomain.com/w/)  
if  
you don’t tell it to do so?

Your error log shows that you are trying to list the files of your root  
directory (so it means you don’t have an index file to be served there),  
which is forbidden by default Nginx configuration to avoid unwanted  
directory listings (which is a great idea, as opposed to Apache’s  
defaults).

## Try to include a redirection (see the rewrite directive configuration[http://nginx.org/en/docs/http/ngx\_http\_rewrite\_module.html#rewrite](http://nginx.org/en/docs/http/ngx_http_rewrite_module.html#rewrite)) so that all your requests to your domain root are forwarded to the /w/ subdirectory.

_B. R._

---

<div class="post-metadata">

**Author:** ![Stylw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/bc79bd/32.png) [@Stylw](https://www.ruby-forum.com/u/Stylw)\
**Post date:** [May 8, 2013, 2:48pm UTC](https://www.ruby-forum.com/t/403-forbidden-error-with-mediawiki/228806/3 "2013-05-08T14:48:30Z")

</div>

Well, I feel pretty stupid now. I used an automatic script to generate  
that  
config and I just assumed that the rewrite would be included.

Thanks & Oops.

Posted at Nginx Forum:

> **[Re: 403 Forbidden error with Mediawiki](https://forum.nginx.org/read.php?2,239004,239011#msg-239011)**
>
> I'm having a frustrating experience trying to get nginx to work properly with mediawiki's pretty urls. For some reason my configuration won’t detect that my mediawiki installation is installed in a folder above root (said folder is called /w/) and...
