我是nginx的新手,之前我一直在使用apache。
在apache中,每个目录都可以有一个.htaccess来定位目录和它的子目录。
这是可能的nginx? 如果是这样,我该怎么做?
非常感谢你!
Nginx没有.htaccess支持,甚至没有用户可以修改configuration的每种目录configuration文件。 也没有任何types的运行时configuration更改(杀-HUP需要重新加载configuration)。 但无论如何nginx主要用于反向代理
.htaccess
是一种解决方法(一种“胶带”)共享主机环境。 它有一个performance(速度)惩罚。
阅读来自NGiXX开发者的certificate链接: https ://nginx.com/resources/wiki/start/topics/examples/likeapache-htaccess/
http://www.nginxtips.com/why-doesnt-nginx-support-htaccess-files/
所以当你configuration(从Apache迁移)的主要规则是:永远不要使用转换器!
看看location和try_files指令:
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
nginx不支持.htaccess,你应该把所有的configuration添加到nginx的标准conf中。