1. Support information
1.1. Supported operating systems and languages
This documentation has moved. https://www.phusionpassenger.com/library/install/supported_operating_systems_and_languages.html
1.2. Where to get support
-
Community discussion forum - post a message here if you’re experiencing problems. Support on this forum is provided by the community on a best-effort basis, so a (timely) response is not guaranteed.
-
Issue tracker - report bugs here.
-
Email support@phusion.nl if you are a Phusion Passenger Enterprise customer. Please mention your order reference. If you are not an Enterprise customer, we kindly redirect you to the community discussion forum instead.
-
Commercial support contracts are also available.
-
Report security vulnerabilities to security@phusion.nl. We will do our best to respond to you as quickly as we can, so please do not disclose the vulnerability until then.
Please consult the Phusion Passenger website for a full list of support resources.
2. Installation
2.1. Synopsis
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/
2.2. Installing or upgrading on Mac OS X with Homebrew
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/
2.3. Installing or upgrading on Debian or Ubuntu
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/apt_repo/
2.3.1. Adding our APT repository
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/apt_repo/
2.3.2. Installing packages
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/apt_repo/
2.3.3. Inserting passenger_root into nginx.conf
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_root
2.4. Installing or upgrading on Red Hat or CentOS
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/yum_repo/
2.4.1. Adding our YUM repository
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/yum_repo/
2.4.2. Installing packages
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/yum_repo/
2.5. Installing or upgrading on Heroku
Please refer to our Heroku Ruby demo for installation and upgrade instructions for Heroku.
2.6. Generic installation, upgrade and downgrade method: via RubyGems
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/
2.7. Generic installation, upgrade and downgrade method: via tarball
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/
2.8. Upgrading from open source to Enterprise
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/apache/upgrading_from_oss_to_enterprise.html
2.9. Cryptographic verification of installation files
2.9.1. Synopsis
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/crypto_verify_install.html
2.9.2. Importing the Phusion Software Signing key
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/crypto_verify_install.html
2.9.3. Verifying the Phusion Software Signing key
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/crypto_verify_install.html
2.9.4. Verifying the gem and tarball
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/crypto_verify_install.html
2.9.5. Verifying Git signatures
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/crypto_verify_install.html
2.9.6. Verifying Debian packages
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/crypto_verify_install.html
2.9.7. Verifying RPM packages
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/crypto_verify_install.html
2.9.8. Revocation
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/crypto_verify_install.html
2.10. Non-interactive, automatic, headless installs or upgrades
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/nginx/noninteractive_install.html
2.11. Customizing the compilation process
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/nginx/customizing_compilation_process.html
2.11.1. Setting the compiler
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/nginx/customizing_compilation_process.html
2.11.2. Adding additional compiler or linker flags
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/nginx/customizing_compilation_process.html
2.11.3. Forcing location of command line tools and dependencies
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/nginx/customizing_compilation_process.html
2.12. Installing as a normal Nginx module without using the installer
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/nginx/install_as_nginx_module.html
2.13. Creating an Nginx init script
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/nginx/nginx_init_script.html
2.14. Disabling without uninstalling
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/nginx/disable.html
2.15. Uninstalling
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/nginx/uninstall/
2.16. Moving to a different directory
This documentation has moved. Please visit https://www.phusionpassenger.com/library/install/nginx/moving.html
3. Deploying a Rack-based Ruby application
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
3.1. Tutorial/example: writing and deploying a Hello World Rack application
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
3.2. Deploying to a virtual host’s root
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
3.3. Deploying to a sub URI
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
3.4. Redeploying (restarting the Rack application)
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/restart_app.html
3.5. Rackup specifications for various web frameworks
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/config_ru.html
4. Deploying a WSGI (Python) application
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
4.1. Tutorial/example: writing and deploying a Hello World WSGI application
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
4.2. Deploying to a virtual host’s root
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
4.3. Deploying to a sub URI
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
4.4. Redeploying (restarting the WSGI application)
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/restart_app.html
4.5. Sample passenger_wsgi.py for Django
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/wsgi_spec.html
5. Deploying a Node.js application
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
6. Deploying a Meteor application
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/
7. Configuring Phusion Passenger
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/
7.1. passenger_root <directory>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_root
7.2. Deployment options
7.2.1. passenger_enabled <on|off>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_enabled
7.2.2. passenger_base_uri <uri>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_base_uri
7.2.3. passenger_document_root <path>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_document_root
7.3. Application loading options
7.3.1. passenger_ruby <filename>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_ruby
7.3.2. passenger_python <filename>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_python
7.3.3. passenger_nodejs <filename>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_nodejs
7.3.4. passenger_meteor_app_settings <filename>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_meteor_app_settings-filename
7.3.5. passenger_app_env <string>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_app_env
7.3.6. rails_env <string>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_app_env
7.3.7. rack_env <string>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_app_env
7.3.8. passenger_app_root <path/to/root>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_app_root
7.3.9. passenger_app_group_name <name>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_app_group_name
7.3.10. passenger_app_type <name>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_app_type
7.3.11. passenger_startup_file <filename>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_startup_file
7.3.12. passenger_spawn_method <string>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_spawn_method
7.3.13. passenger_env_var <name> <value>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_env_var
7.3.14. passenger_load_shell_envvars <on|off>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_load_shell_envvars
7.3.15. passenger_rolling_restarts <on|off>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_rolling_restarts
7.3.16. passenger_resist_deployment_errors <on|off>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_resist_deployment_errors
7.4. Security options
7.4.1. passenger_user_switching <on|off>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_user_switching
7.4.2. passenger_user <username>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_user
7.4.3. passenger_group <group name>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_group
7.4.4. passenger_default_user <username>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_default_user
7.4.5. Passenger_default_group <group name>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_default_group
7.4.6. passenger_show_version_in_header <on|off>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_show_version_in_header
7.4.7. passenger_friendly_error_pages <on|off>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_friendly_error_pages
7.5. Resource control and optimization options
7.5.1. passenger_max_pool_size <integer>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_pool_size
7.5.2. passenger_min_instances <integer>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_min_instances
7.5.3. passenger_max_instances <integer>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_instances
7.5.4. passenger_max_instances_per_app <integer>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_instances_per_app
7.5.5. passenger_pool_idle_time <integer>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_pool_idle_time
7.5.6. passenger_max_preloader_idle_time <integer>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_preloader_idle_time
7.5.7. passenger_start_timeout <seconds>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_start_timeout
7.5.8. passenger_concurrency_model <process|thread>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_concurrency_model
7.5.9. passenger_thread_count <number>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_thread_count
7.5.10. passenger_max_requests <integer>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_requests
7.5.11. passenger_max_request_time <seconds>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_request_time
7.5.12. passenger_memory_limit <integer>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_memory_limit
7.5.13. passenger_stat_throttle_rate <integer>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_stat_throttle_rate
7.5.14. passenger_pre_start <url>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_pre_start
7.6. Connection handling options
7.6.1. passenger_set_header <HTTP header name> <value>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_set_header
7.6.2. passenger_max_request_queue_size <number>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_max_request_queue_size
7.6.3. passenger_request_queue_overflow_status_code <code>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_request_queue_overflow_status_code
7.6.4. passenger_sticky_sessions <on|off>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_sticky_sessions
7.6.5. passenger_sticky_sessions_cookie_name
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_sticky_sessions_cookie_name
7.6.6. passenger_ignore_client_abort <on|off>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_ignore_client_abort
7.6.7. passenger_intercept_errors <on|off>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_intercept_errors
7.6.8. passenger_pass_header <header name>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_pass_header-header-name
7.6.9. passenger_ignore_headers <header names…>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_ignore_headers
7.6.10. passenger_headers_hash_bucket_size <size>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_headers_hash_bucket_size
7.6.11. passenger_headers_hash_max_size <size>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_headers_hash_max_size
7.6.12. passenger_buffer_response <on|off>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_buffer_response
7.6.13. passenger_response_buffer_high_watermark <bytes>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_response_buffer_high_watermark
7.6.16. passenger_busy_buffers_size
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_buffer_size-passenger_buffers-passenger_busy_buffers_size
7.7. Logging and debugging options
7.7.1. passenger_log_level <integer>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_log_level
7.7.2. passenger_log_file <filename>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_log_file
7.7.3. PassengerFileDescriptorLogFile <filename>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_file_descriptor_log_file
7.7.4. passenger_debugger <on|off>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_debugger
7.8. Advanced options
7.8.1. passenger_instance_registry_dir <directory>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_instance_registry_dir
7.8.2. passenger_data_buffer_dir <directory>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_data_buffer_dir
7.8.3. passenger_fly_with <socket filename>
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/reference/#passenger_fly_with
7.9. Deprecated or removed options
The following options have been deprecated or removed. Some are still supported for backwards compatibility reasons.
7.9.2. passenger_debug_log_file
This option has been renamed in version 5.0.5 to passenger_log_file.
8. Troubleshooting
8.1. Generic troubleshooting tips
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/
8.2. Why does the first request take a long time?
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/?a=why-does-the-first-request-take-a-long-time
8.3. Upon accessing the web app, Nginx reports a "Permission denied" error
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/?a=upon-accessing-the-web-app-nginx-reports-a-permission-denied-error
8.4. I get "command not found" when running a Phusion Passenger command through sudo
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/?a=i-get-command-not-found-when-running-a-passenger-command-through-sudo
8.5. The application thinks its not on SSL even though it is
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/
8.6. Ruby on Rails-specific troubleshooting
8.6.1. The "About your application’s environment" link does not work
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/ruby/#the-about-your-application-s-environment-link-does-not-work
8.6.2. The Rails application reports that it’s unable to start because of a permission error
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/troubleshooting/ruby/#the-rails-application-reports-that-it-s-unable-to-start-because-of-a-permission-error
8.6.3. The Rails application’s log file is not being written to
There are a couple things that you should be aware of:
-
By default, Phusion Passenger runs Rails applications in production mode, so please be sure to check production.log instead of development.log.
See rails_env for configuration. - By default, Phusion Passenger runs Rails applications as the owner of config.ru. So the log file can only be written to if that user has write permission to the log file. Please chmod or chown your log file accordingly.
See User switching (security) for details.
If you’re using a RedHat-derived Linux distribution (such as Fedora or CentOS) then it is possible that SELinux is interfering. RedHat’s SELinux policy only allows Apache to read/write directories that have the httpd_sys_content_t security context. Please run the following command to give your Rails application folder that context:
chcon -R -h -t httpd_sys_content_t /path/to/your/rails/app
9. Analysis and system maintenance
9.1. Inspecting memory usage
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/overall_status_report.html
9.2. Inspecting Phusion Passenger’s internal status
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/overall_status_report.html
9.3. Debugging frozen applications
If one of your application processes is frozen (stopped responding), then you can figure out where it is frozen by killing it with SIGABRT. This will cause the processs to print a backtrace, after which it aborts. The backtrace information is logged into the web server error log file.
In case of Ruby applications, you can also send the SIGQUIT signal to have it print a backtrace without aborting.
9.4. Accessing individual application processes
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/request_individual_processes.html
9.5. Attaching an IRB console to an application process
This documentation has moved. Please visit https://www.phusionpassenger.com/library/admin/nginx/debugging_console/
10. Tips
10.1. User Switching (security feature)
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/user_sandboxing.html
10.1.1. Requirements
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/user_sandboxing.html
10.1.2. Effects
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/user_sandboxing.html
10.1.3. Caveats & troubleshooting
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/user_sandboxing.html
10.1.4. Red Hat and CentOS caveats
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/user_sandboxing.html
10.1.5. Finding out what user an application is running as
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/user_sandboxing.html
10.2. Copy-on-write memory support (reducing memory consumption of Ruby applications)
Phusion Passenger automatically leverages operating system virtual memory copy-on-write features in order to reduce the memory usage of Ruby applications. Experience has shown that this reduces memory usage by 33% on average. For this mechanism to work, a Ruby interpreter with a copy-on-write friendly garbage collector is required. The following Ruby interpreters have copy-on-write friendly garbage collectors:
-
MRI Ruby >= 2.0. Versions prior to 2.0 did not have a copy-on-write friendly garbage collector.
-
Ruby Enterprise Edition, which was Phusion’s branch of MRI Ruby 1.8 with a copy-on-write friendly garbage collector and other enhancement. It has reached End-Of-Life as of 2012, but remains available for legacy systems.
10.3. Tuning for Server Sent Events and WebSockets
This documentation has moved. Please visit https://www.phusionpassenger.com/library/config/nginx/tuning_sse_and_websockets.html
10.4. Bundler support
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/ruby/bundler.html
10.4.1. Does Phusion Passenger itself need to be added to the Gemfile?
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/ruby/bundler.html#does-passenger-itself-need-to-be-added-to-the-gemfile
10.5. Installing multiple Ruby on Rails versions
Each Ruby on Rails applications that are going to be deployed may require a specific Ruby on Rails version. You can install a specific version with this command:
gem install rails -v X.X.X
where X.X.X is the version number of Ruby on Rails.
All of these versions will exist in parallel, and will not conflict with each other. Phusion Passenger will automatically make use of the correct version.
10.6. Making the application restart after each request
In some situations it might be desirable to restart the web application after each request, for example when developing a non-Rails application that doesn’t support code reloading, or when developing a web framework.
To achieve this, simply create the file tmp/always_restart.txt in your application’s root folder. Unlike restart.txt, Phusion Passenger does not check for this file’s timestamp: Phusion Passenger will always restart the application, as long as always_restart.txt exists.
If you’re just developing a Rails application then you probably don’t need this feature. If you set rails_env development in your web server configuration, then Rails will automatically reload your application code after each request. always_restart.txt is mostly useful when you’re using a web framework that doesn’t support code reloading by itself, of when you’re working on a web framework yourself. |
10.7. How to fix broken images/CSS/JavaScript URIs in sub-URI deployments
Some people experience broken images and other broken static assets when they deploy their application to a sub-URI (i.e. http://mysite.com/railsapp/). The reason for this usually is that you used a static URI for your image in the views. This means your img source probably refers to something like /images/foo.jpg. The leading slash means that it’s an absolute URI: you’re telling the browser to always load http://mysite.com/images/foo.jpg no matter what. The problem is that the image is actually at http://mysite.com/railsapp/images/foo.jpg. There are two ways to fix this.
The first way (not recommended) is to change your view templates to refer to images/foo.jpg. This is a relative URI: note the lack of a leading slash). What this does is making the path relative to the current URI. The problem is that if you use restful URIs, then your images will probably break again when you add a level to the URI. For example, when you’re at http://mysite.com/railsapp the browser will look for http://mysite.com/railsapp/images/foo.jpg. But when you’re at http://mysite.com/railsapp/controller. the browser will look for http://mysite.com/railsapp/controller/images/foo.jpg. So relative URIs usually don’t work well with layout templates.
The second and highly recommended way is to always use Rails helper methods to output tags for static assets. These helper methods automatically take care of prepending the base URI that you’ve deployed the application to. For images there is image_tag, for JavaScript there is javascript_include_tag and for CSS there is stylesheet_link_tag. In the above example you would simply remove the <img> HTML tag and replace it with inline Ruby like this:
<%= image_tag("foo.jpg") %>
This will generate the proper image tag to $RAILS_ROOT/public/images/foo.jpg so that your images will always work no matter what sub-URI you’ve deployed to.
These helper methods are more valuable than you may think. For example they also append a timestamp to the URI to better facilitate HTTP caching. For more information, please refer to the Rails API docs.
10.8. Out-of-Band Work and Out-of-Band Garbage Collection
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/ruby/out_of_band_work.html
10.9. Hooks
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/hooks.html
10.9.1. Example
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/hooks.html#example
10.9.2. Environment
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/hooks.html#environment
10.9.3. Blocking and concurrency
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/hooks.html#blocking-and-concurrency
10.9.4. Error handling
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/hooks.html#error-handling
10.9.5. Compatibility
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/hooks.html#compatibility
10.9.6. Available hooks
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/hooks.html#available-hooks
10.10. Flying Passenger
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/flying_passenger.html
10.10.1. Requirements
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/flying_passenger.html
10.10.2. Basic usage
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/flying_passenger.html
10.10.3. Configuring Flying Passenger
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/flying_passenger.html
10.10.4. Managing the Flying Passenger daemon
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/flying_passenger.html
10.10.5. Using Flying Passenger with MRI 1.8 or JRuby
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/flying_passenger.html
10.10.6. Caveats and limitations
This documentation has moved. Please visit https://www.phusionpassenger.com/library/deploy/nginx/flying_passenger.html
11. Under the hood
11.1. Page caching support
For each HTTP request, Phusion Passenger will automatically look for a corresponding page cache file, and serve that if it exists. It does this by appending ".html" to the filename that the URI normally maps to, and checking whether that file exists. This check occurs after checking whether the original mapped filename exists (as part of static asset serving). All this is done without the need for special mod_rewrite rules.
For example, suppose that the browser requests /foo/bar.
-
Phusion Passenger will first check whether this URI maps to a static file, i.e. whether the file foo/bar exists in the web application’s public directory. If it does then Phusion Passenger will serve this file through the web server immediately.
-
If that doesn’t exist, then Phusion Passenger will check whether the file foo/bar.html exists. If it does then Phusion Passenger will serve this file through the web server immediately.
-
If foo/bar.html doesn’t exist either, then Phusion Passenger will forward the request to the underlying web application.
Note that Phusion Passenger’s page caching support doesn’t work if your web application uses a non-standard page cache directory, i.e. if it doesn’t cache to the public directory. In that case you’ll need to use mod_rewrite to serve such page cache files.
11.2. Phusion Passenger and its relationship with Ruby
11.2.1. How Ruby is used
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/lightweight_ruby_dependency.html
11.2.2. When the system has multiple Ruby interpreters
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/ruby/multiple_rubies.html
11.3. How Phusion Passenger detects whether a virtual host is a web application
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/app_autodetection/nginx/
12. Appendix A: About this document
The text of this document is licensed under the Creative Commons Attribution-Share Alike 3.0 Unported License.
Phusion Passenger is brought to you by Phusion.
"Passenger", "Phusion Passenger" and "Union Station" are registered trademarks of Phusion Holding B.V.
13. Appendix B: Terminology
13.1. Application root
The root directory of an application that’s served by Phusion Passenger.
In case of Ruby on Rails applications, this is the directory that contains Rakefile, app/, config/, public/, etc. In other words, the directory pointed to by RAILS_ROOT. For example, take the following directory structure:
/apps/foo/ <------ This is the Rails application's application root! | +- app/ | | | +- controllers/ | | | +- models/ | | | +- views/ | +- config/ | | | +- environment.rb | | | +- ... | +- public/ | | | +- ... | +- ...
In case of Rack applications, this is the directory that contains config.ru. For example, take the following directory structure:
/apps/bar/ <----- This is the Rack application's application root! | +- public/ | | | +- ... | +- config.ru | +- ...
In case of Python (WSGI) applications, this is the directory that contains passenger_wsgi.py. For example, take the following directory structure:
/apps/baz/ <----- This is the WSGI application's application root! | +- public/ | | | +- ... | +- passenger_wsgi.py | +- ...
14. Appendix C: Spawning methods explained
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/spawn_methods/
14.1. The most straightforward and traditional way: direct spawning
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/spawn_methods/
14.2. The smart spawning method
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/spawn_methods/
14.2.1. How it works
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/spawn_methods/
14.2.2. Summary of benefits
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/spawn_methods/
14.3. Smart spawning caveat #1: unintentional file descriptor sharing
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/spawn_methods/
14.3.1. Example 1: Memcached connection sharing (harmful)
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/spawn_methods/
14.3.2. Example 2: Log file sharing (not harmful)
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/spawn_methods/
14.4. Smart spawning caveat #2: the need to revive threads
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/spawn_methods/
15. Appendix D: About environment variables
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/environment_variables.html
15.1. Working with environment variables
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/environment_variables.html#working-with-environment-variables
15.2. The PATH environment variable
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/environment_variables.html#the-path-environment-variable
15.2.1. Adding Phusion Passenger’s administration tools to PATH
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/environment_variables.html#adding-passenger-s-administration-tools-to-path
15.3. Making environment variables permanent
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/environment_variables.html#making-environment-variables-permanent
15.3.1. bash
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/environment_variables.html#bash
15.3.2. Apache
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/environment_variables.html#apache
15.3.3. Nginx
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/environment_variables.html#nginx
15.3.4. cron
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/environment_variables.html#cron
15.3.5. Phusion Passenger-served apps
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/environment_variables.html#passenger-served-apps
15.4. Environment variables and sudo
This documentation has moved. Please visit https://www.phusionpassenger.com/library/indepth/environment_variables.html#environment-variables-and-sudo