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

I am new to nginx and I have been on apache before.

In apache, each directory can have a .htaccess to target the directory and and it's subdirectories.

Is this possible for nginx? If so, how do I do that?

Thank you very much!

share|improve this question
up vote 0 down vote accepted

Nginx doesn't have .htaccess support nor even any kind of per-directory configuration files in which users can modify configuration. Also no any kind of runtime configuration changes (kill -HUP needed to reload config). But anyway nginx mostly used for reverse proxying

share|improve this answer

nginx doesn't have .htaccess support, you should add all the configuration to nginx standard conf.

share|improve this answer
.htaccess

is a workaround (kind of a "duct tape") for shared hosting environments. It has a performance (speed) penalty.

read prooflink from NGiИX developers: https://nginx.com/resources/wiki/start/topics/examples/likeapache-htaccess/

http://www.nginxtips.com/why-doesnt-nginx-support-htaccess-files/

So the main rule when you configuring (migrating from apache) is: NEVER USE CONVERTERS!!!

Look at location and try_files directives instead:

nginx.org/en/docs/http/ngx_http_core_module.html#location

nginxtips.com/nginx-location-directive/

nginx.org/en/docs/http/ngx_http_core_module.html#try_files

nginx.org/en/docs/http/ngx_http_rewrite_module.html

share|improve this answer

Your Answer

 
discard

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.