Sign up ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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

1 Answer 1

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.