I'm migrating a website from a server that has Apache web-server to another server that is running Nginx web-server, and I wanted to convert the .htaccess files, the problem is not just the syntax but also the file name, is it also ".htaccess" or what?
相关问题
- Backbone.js PushState routes .htaccess only workin
- Stop .htaccess redirect with query string
- .htaccess rule, redirecting old unexistent address
- How to deploy a web application Aurelia in an Apac
- Apache Directory Studio not opening
Here's a tool I use:
http://www.anilcetin.com/convert-apache-htaccess-to-nginx/
It is not 100% accurate but it's pretty good base
Also, here's a link about converting the rules:
http://nginx.org/en/docs/http/converting_rewrite_rules.html
This one can help a little:
http://wiki.nginx.org/HttpRewriteModule#rewrite
EDIT:
The file name should be
nginx.conf
Nginx does not have support for .htaccess files.
But .htaccess files are bad. It's a way to put parts of the apache configuration erverywhere on the filesystem and to tell apache to check the filesystem at every request to see if you do not have some special configuration in place. The only real usage of .htaccess file is to delegate a small part of the configuration to the user if you are a host provider and wanted to allow some web server configuration for your users.
Nginx configuration is compiled when nginx restart. Of course you can include several files that you can put in your web directory if you really do not care about information disclosure problems (like users seing your web server configuration), but having the same thing as a .htaccess, read each time a request is done, is not in the nginx way.
http://wiki.nginx.org/LikeApache-htaccess:
Look at here:
https://www.digitalocean.com/community/questions/configuring-multiple-domains-and-subdomains-dns-nginx-issues-abound