Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Let's say i have a virtual host in Nginx wtih name and root directory named public. Inside public i have 2 dirs dir1 and dir2. How i redirect the request to to dir1? I know it's a simple question, but i am new to nginx.

share|improve this question

Do you want to redirect visitors from to ?

Then you can use a rewrite statement to rewrite. When you include http:// or https:// in the rewrite it will redirect visitors.


If you just want to use dir1 to serve content from, you can use alias, or you can rewrite without http:// like this:

rewrite / /dir1/;
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.