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

前端 未结 3 1377
野性不改
野性不改 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:58

    Passenger author here. There is no equivalent for 'AllowOverride all' in Nginx, and you don't need it either. All you need is a virtual host block with the 'root' pointing to your app's 'public' directory, and 'passenger_enabled on':

    server {
       listen 80;
       server_name www.example.com;
       root /var/www/site/public;
       passenger_enabled on;
    }
    

    ...as explained by the official Passenger documentation's deployment instructions.

    passenger_app_root and passenger_document_root are automatically inferred for you from root. There is no need for try_files either because Passenger automatically serves static files for you through Nginx.

    You should read the official documentation.

提交回复
热议问题