官术网_书友最值得收藏!

How to do it...

Passenger comes with a basic tool to help create your NGINX configuration for you. To use it, run the following:

passenger start --debug-nginx

I have simplified the generated configuration, simply because many of the directives were setting it to the defaults anyway.

In the main NGINX configuration (generally, /etc/nginx/nginx.conf), we need to add the following within the http directive block:

include '/var/lib/gems/2.3.0/gems/passenger-5.0.27/resources/mime.types'; 
passenger_root '/var/lib/gems/2.3.0/gems/passenger-5.0.27'; 
passenger_abort_on_startup_error on; 
passenger_ctl cleanup_pidfiles L3RtcC9wYXNzZW5nZXItc3RhbmRhbG9uZS41aDBnZG0vdGVtcF9kaXJfdG91Y2hlci5waWQ=; 
passenger_ctl integration_mode standalone; 
passenger_ctl standalone_engine nginx; 
passenger_user_switching off; 
passenger_ruby /usr/bin/ruby2.3; 
passenger_user www-data; 
passenger_default_user www-data; 
passenger_analytics_log_user www-data; 
passenger_log_level 3; 

We then add a server configuration specific to our demo site, for example, /etc/nginx/conf.d/rails.conf:

server { 
    server_name  railsdemo.nginxcookbook.com; 
    listen 80; 
    access_log  /var/log/nginx/rails-access.log  combined; 
    root /var/www/railsdemo/public; 
    passenger_app_root /var/www/railsdemo; 
    passenger_enabled on; 
 
    location ~ ^/assets/ { 
    } 
} 
passenger_pre_start http://0.0.0.0:3000/; 
主站蜘蛛池模板: 中卫市| 梧州市| 东平县| 巴彦县| 山东省| 阜宁县| 冀州市| 芦山县| 阿拉善左旗| 依兰县| 河源市| 嘉祥县| 苏尼特右旗| 盐池县| 闽侯县| 赣州市| 西乡县| 尼木县| 大名县| 尤溪县| 枝江市| 琼海市| 吴桥县| 吉水县| 庐江县| 潜山县| 滁州市| 文安县| 祁连县| 墨竹工卡县| 铜陵市| 明水县| 金山区| 惠来县| 石渠县| 德昌县| 鹤山市| 龙州县| 峡江县| 朝阳县| 南投县|