書名: NGINX Cookbook作者名: Tim Butler本章字數(shù): 128字更新時間: 2021-07-03 00:04:29
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/;
推薦閱讀
- Boost.Asio C++ Network Programming(Second Edition)
- Oracle WebLogic Server 12c:First Look
- Rust實戰(zhàn)
- 軟件架構設計:大型網(wǎng)站技術架構與業(yè)務架構融合之道
- 無代碼編程:用云表搭建企業(yè)數(shù)字化管理平臺
- jQuery從入門到精通 (軟件開發(fā)視頻大講堂)
- Backbone.js Blueprints
- Apex Design Patterns
- PHP 7+MySQL 8動態(tài)網(wǎng)站開發(fā)從入門到精通(視頻教學版)
- Mastering Linux Security and Hardening
- 21天學通C++(第5版)
- C語言程序設計習題與實驗指導
- 運維前線:一線運維專家的運維方法、技巧與實踐
- Django實戰(zhàn):Python Web典型模塊與項目開發(fā)
- Python網(wǎng)絡爬蟲技術與應用