You are not logged in.

#1 2011-11-28 21:41:34

FathisAeril
Member
Registered: 2010-07-02
Posts: 82

Nginx rewrite question

Hey guys, one quick question regarding nginx and its rewrite rules. Currently on the a recently setup server, with /srv/http as the document_root. I'm keeping it as the bare /srv/http/ so that I can do (domain)/wordpress or (domain)/owncloud etc etc at will, its simple, clean, direct. The only snag is if I just do (domain) I want it to default to the wordpress instance instead of a blank page.

I know Nginx can do something like this its rewrite rules, but im new enough to nginx that I'm not really sure on how to write them, in a way that would ONLY kick in if given a bare domain, and would leave all other variations, like (domain)/owncloud alone. I copied the server section of nginx.conf below, if someone could give me a hand that'd be awesome.

server {
        listen       80;
        server_name  example.com;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root  /srv/http;
            index  index.html index.htm index.php;
        }


It doesn't matter how much training you have. A broken rib is still a broken rib.

Offline

#2 2011-12-07 23:36:05

slot
Member
Registered: 2008-09-08
Posts: 67

Re: Nginx rewrite question

FathisAeril wrote:

server {
        listen       80;
        server_name  example.com;
        }

Nginx takes the most specific fit first, so the bare domain name gets the rest

Offline

Board footer

Powered by FluxBB