How to convert Apache's `AllowOverride all` to nginx

前端 未结 3 1405
野性不改
野性不改 2021-01-27 10:27

I have an Apache2 & Passenger site for Rails app, that uses following configuration:


  ServerName localhost
  DocumentRoot /var/www/         


        
3条回答
  •  天命终不由人
    2021-01-27 10:59

    The accepted answer was more related to Passenger documentation. The main reason I stumbled upon this thread is that I was looking to migrate Allow Override setting of .htaccess to nginx.conf.

    If you don't know much about nginx you would assume(as I did) that there must be a way to have nginx.conf per directory basis just like we have in Apache.

    But that's not the way nginx implemented its settings system and the reason is that structure-wise they find central configurations better instead of having settings scattered over multiple files(.htaccess) making it tough to know the settings effective.

    So, to migrating your settings from a .htaccess file, one has to copy those settings(equivalent syntax of nginx) over to single nginx.conf Server{...} block.

    Reference links:

    https://www.nginx.com/blog/converting-apache-to-nginx-rewrite-rules/

    https://www.digitalocean.com/community/tutorials/how-to-migrate-from-an-apache-web-server-to-nginx-on-an-ubuntu-vps

提交回复
热议问题