Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

iTechGuides is reader-supported. When you buy through links on our site, we may earn an affiliate commission. As an Amazon Associate I earn from qualifying purchases. Learn more

To deploy a Rails application with Apache and Passenger on a VPS, install Passenger’s Apache integration, keep the application in a persistent directory owned by a non-root deployment user, point the Apache virtual host’s DocumentRoot to the app’s public directory, select the correct Ruby with PassengerRuby, and restart and validate Apache. A production deployment also needs the database, credentials, DNS, and operational safeguards required by that particular application.

The procedure below uses a conventional layout such as /var/www/myapp/code. Replace the hostname, paths, Ruby executable, repository, and branch with values for your server and application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

What the finished deployment looks like

Apache accepts the HTTP request for your hostname. Its virtual host serves static files from the Rails application’s public directory and passes dynamic Rails requests to Passenger. Passenger starts the application with the Ruby interpreter you specify and manages its application processes.

The repository itself should not be Apache’s document root. If the code is stored in /var/www/myapp/code, the public web root is:

#1 Best Overall
Sale
Compressed Air Duster,130000RPM Super Power Cordless Air Duster,Rechargeable Brushless Blower,3 Gear Adjustable Blower with LED Light,Dust Remover for Computer/House/Outdoor/Car
  • Powerful Turbo Fan:CAGIWIRU Electric Air Duster have reached speed up to 130000RPM,Can efficient remove dust and debris.With LED light and Three Adjustable Speed to meet with different cleaning tasks.
  • With Attached USB C Fasting Charging cable.Charing 3 hours,Enjoy up to 240 minutes of use on the lowest setting, For third speed can use for 25mins.with four charging options to meet with your needs.
  • Wide Application: attached 5 different nozzles,making it suitable for a variety of scenes, such as car,pet, pc, keyboards, and other electronic devices. It also serves for office and home clean duster.
  • Handy Design & Portable:Cordless air duster electric nozzle is Light weight and small size, design and comfortable to hold and space saving, convenient to carry around. You can put it in your room or inside the car without taking up space.
  • Economical &Reusable: Built durable materials with a long-lasting battery,our CAGIWIRU air duster it's a sustainable alternative to disposable air cans.
/var/www/myapp/code/public

That distinction is the most important configuration detail. Passenger’s Apache reference states: “The virtual host’s document root must point to your application’s public subdirectory.”

Prerequisites on the VPS

Connect to a supported Linux distribution over SSH with an account that can use sudo. The server needs the software and services required by both Passenger and the Rails application.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Infrastructure checklist

  • Apache HTTP Server.
  • Ruby and the build tools required by the selected Passenger installation method.
  • Rake, as required by Passenger’s Debian/Ubuntu installation documentation.
  • Git, if the application will be obtained from a Git repository.
  • The database service required by the Rails application.
  • A public hostname whose DNS record resolves to the VPS when the site is ready for public traffic.

Ubuntu’s server guidance identifies a web server and a database service as prerequisites for Rails. The exact package names and Passenger repository distribution identifiers change over time, so select the current installation instructions for the distribution and release running on your VPS rather than copying an old repository line.

Information to collect before installing

  • The production repository URL and branch or tag.
  • The Ruby version required by the application’s lockfile and deployment policy.
  • The database name, user, password, host, and port expected by the application.
  • The production secrets and environment variables needed by Rails credentials, storage, mail, and third-party integrations.
  • The hostname that will be placed in ServerName.

Passenger’s deployment pages describe the application layout and Apache integration, but they do not define one universal secrets, database-migration, HTTPS, firewall, backup, or release-management procedure. Those parts must follow the application’s requirements and your VPS operating practices.

Choose how to install Passenger

Passenger’s Apache integration can be installed in two broad ways. Decide before provisioning so that the Ruby and package choices are consistent.

Rank #2
EVEO® Screen Cleaner Spray Kit (Streak-Free) TV Screen Cleaner for Smart TV, Lcd, LEd, Oled | Computer Screen Cleaner Spray and Wipe Microfiber Cloth - TV, Monitor, Laptop, iPad, Car - 6.7oz 1 Pack
  • Screen Cleaner is Your Screen’s New Bestfriend! - EVEO is proud to present a screen cleaner that’s perfectly suited for your TV. Meet your new screen cleaner, computer screen cleaner, laptop cleaner, iPad cleaner, Macbook,tv cleaner or any other electronic device. Our screen cleaner spray and wipe along with the included plush microfiber cloth, easily removes dust, fingerprints & other smudges on the screen’s surface. Clean effectively for a streak-free screen
  • Gentle on your Screens - Our screen cleaner spray and wipes is compatible to be used even for the most sensitive LCD, LED, CRT, and OLED screens in proper use. Be at ease knowing that this product is compatible with all the major brands: LG, SONY, Samsung, Sharp, iPad, iPhone, Android screens, Kindle, PC monitors - we’ve got you covered! Can be used as LCD screen cleaner, tv cleaner, smart tv screen cleaner, and more
  • Premium Super Soft Plush Microfiber Cloth - Included in this efficient screen cleaning kit. This screen cleaner spray and wipe has our signature plush microfiber cloth specially designed to comply with screens and monitors and leave them streak-free. Has been shown to effectively absorbs stubborn stains, zero streaks, and no fiber shedding. Always use this together with our screen cleaner for the best results
  • Easy-to-Use Screen Cleaner Kit + microfiber cleaning cloth - The EVEO Screen Cleaning Kit will easily be your new favorite tool when it comes to taking care of the things you love most, quick and easy solution for a streak-free screen. Simply screw on the sprayer gun on the screen cleaner bottle. Spray the cleaning liquid onto the microfiber cloth, then wipe the screen until desired cleanliness & shine is achieved.
  • Quality Screen Care Kit Worth Purchasing - Enjoy a convenient Screen Cleaner anytime, anywhere you need it. Your satisfaction is our top priority. We stand behind the quality of our products and that’s why, you shouldn’t be worrying at all. We manufacture the Best Screen Cleaner. and can be used for laptop cleaning kit, laptop screen cleaner, tv screen cleaner for smart tv. MacBook screen cleaner, monitor cleaner or screen cleaner spray for electronic devices with microfiber cleaning cloth
Route What you do Best fit Trade-off
Passenger gem and Apache module build Install the Passenger gem, run passenger-install-apache2-module, then add the generated Apache configuration, including LoadModule and PassengerRoot. When you need control over the Passenger build or cannot use the packaged repository. You must preserve and maintain the generated Apache directives yourself.
Packaged Apache module Install the Passenger Apache package from Passenger’s repository and integrate it with the distribution’s Apache configuration. When package management and distribution integration are the priority. Repository instructions and distribution identifiers must match the current operating-system release.

Neither route changes the required virtual-host concepts: Apache still needs the correct DocumentRoot, directory permissions, disabled MultiViews, and an explicit Ruby interpreter when more than one Ruby is installed.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Provision Apache, Ruby, Git, and the database

  1. Update the VPS according to your distribution’s normal procedure. Use a supported release and keep administrative work in the sudo account rather than running the application as root.
  2. Install Apache and Git. Use the package manager for the distribution. Confirm that Apache’s service can start before adding Passenger.
  3. Install Ruby and Rake. If the application uses a version manager or a separately installed Ruby, record the absolute path to the interpreter that should run this application.
  4. Install the build prerequisites required by your chosen Passenger route. The current Passenger installation selector lists the Debian/Ubuntu prerequisites; use the equivalent instructions for another distribution.
  5. Install and configure the database service required by the application. A Rails app may require a database server even when Apache and Passenger are working correctly.

Do not treat a successful Apache page as proof that Rails is ready. Database connectivity, application dependencies, credentials, and migrations are separate deployment conditions.

Install Passenger and validate the Apache integration

Using the gem and module-build route

  1. Install the Passenger gem using the Ruby environment selected for the server.
  2. Run passenger-install-apache2-module.
  3. Allow the installer to check prerequisites and build the Apache module.
  4. At the end, copy the generated Apache configuration into the appropriate Apache configuration file. The generated snippet contains directives such as LoadModule and PassengerRoot; copy the complete snippet rather than only one line.

Using the packaged-module route

  1. Follow Passenger’s current repository instructions for the exact VPS distribution and release.
  2. Install the packaged Passenger Apache module and any listed dependencies.
  3. Use the distribution’s Apache integration mechanism to load the module.

Restart and validate

Restart Apache after Passenger is installed. Then run Passenger’s official validation command:

sudo /usr/bin/passenger-config validate-install

The validation step is required after the Apache restart. If it reports a missing module, an invalid configuration, or an unavailable Ruby, fix that issue before creating the application virtual host. A clean validation confirms the integration, not the health of your particular Rails application.

Create a dedicated deployment user and persistent application directory

Keep application code outside a temporary SSH session directory and avoid running the Rails process as root. Passenger’s own-server example uses a non-root application user and /var/www/myapp.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Sale
BladeHawks RGB Gaming Mouse Pad Extra Large Extended 31.5x12 Inch-Black | LED mouse pad with 14 lighting modes, covers keyboard & mouse, anti-slip rubber base, waterproof surface, USB powered
  • 【Large size】:Measuring 800 x 300 mm/ 31. 5×12 inches, which is wider and taller than others. Large mouse pad can perfectly fit your keyboard and mouse of any size, and there is also ample space for peripherals such as phones, tablets, etc.
  • 【LED backlight mouse pad】:Blade Hawks RGB mouse pad provides 7 static modes and 7 dynamic modes will give you the options you are looking for. Power-off memory function remembers the last lighting mode you selected. The super glow fiber Chroma will give you a colorful gaming setup that you want.
  • 【Anti-slip rubber base】:Made from Natural rubber, this gaming mousepad will firmly grip your desktop, allowing you to enjoy the ultimate precision in the games you are most passionate about. It also comes with a texture that enhances this ability even further.
  • 【Smooth and waterproof surface】: Micro-textured cloth surface, for extremely precise mouse control and a smooth movement. When liquid splashes on the gaming mouse pad, it forms water droplets and slides down. Will not delay your work or gameplay.
  • 【Plug and play】: This mouse and keyboard pad is powered by USB, plug and play, no driver required. One button control light modes. Press one time to change the lighting mode, press twice to change the brightness, press and hold about 3 seconds turn ON/OFF.
  1. Create a dedicated deployment user using your distribution’s user-management command.
  2. Create the application directory:
sudo mkdir -p /var/www/myapp
  1. Assign ownership to the deployment user:
sudo chown myappuser: /var/www/myapp
  1. Change into that directory and clone the application as the deployment user:
cd /var/www/myapp
sudo -u myappuser -H git clone https://github.com/username/myapp.git code

Use your actual repository and the branch or tag selected for production. The -H option gives the command the deployment user’s home environment, which is important when Git credentials or a Ruby version manager are configured for that user.

Prepare the Rails release

Passenger can only boot an application that is complete from Rails’ perspective. The exact release workflow belongs to the application, but the following items must be resolved before testing the hostname.

Install Ruby dependencies

From the application directory, install the bundle with the deployment user’s Ruby and the options appropriate for production. Verify that the resulting Ruby executable is the same one you will place in PassengerRuby; installing gems under one Ruby and configuring Passenger to use another is a common cause of boot failures.

Compile assets when required

Rails versions and application configurations differ. Compile assets when the application release process requires it, and confirm that the generated assets are available under the deployed public tree.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Configure credentials and environment variables

Provide the production secrets, database settings, storage configuration, mail settings, and other environment variables expected by the application. Do not put secrets into the public directory or commit them to the repository.

Rank #4
Sale
Vaydeer Wrist Rest for Keyboard and Mouse, Computer Ergonomic Wrist Support Pad, Soft Memory Foam Arm Cushion for Desk, Palm Hand Office Laptop Typing
  • 【Softer and More Comfortable】Vaydeer wrist rest has unique diamond pattern, which is the combination of softness and aesthetics. The materials of wrist rest are improved into higher quality memory foam and covered with silky smooth lycra. The computer wrist rest makes you as comfortable and cushiony as like rest your wrists on clouds.
  • 【Ergonomic Wrist Saver】The wrist rests for keyboard and mouse comes with a 17.32×3.15×0.83 inch keyboard wrist pad and a 5.94×3.15×0.83 inch mouse wrist support. Based on ergonomic design, the unique concave shape is the perfect fit for your wrist joints. The wrist rest pad fits most computer keyboards and laptops, improve hand and wrist posture, release your wrist and arm stress.
  • 【Non-Slip Rubber Bottom】Featuring an anti-skid silicone base on the bottom, this wrist keyboard support stays firmly in place on your desk, preventing the padding from sliding around, ensuring stable and consistent wrist support during extended computer sessions.
  • 【Better Experience & Pain Relief】Our keyboard arm rest is beneficial to alleviate the soreness caused by direct contact and friction between your arm and a hard desk surface, reducing the risk of wrist fatigue or carpal tunnel. The soft texture of memory foam can evenly distribute the pressure around your wrists and provide good support with just enough give.
  • 【Helpful in Multiple Scenarios】Whether you're working, studying, writing, typing, gaming, this keyboard and mouse rest combo is an essential accessory to add comfort and support to your hands and wrists. It’s also a great gift for men, women, family, friend, coworker, gamer, teacher, etc.

Prepare the database

Create the production database account and run the application’s approved schema or migration procedure. Passenger and Apache do not create the database, supply credentials, or decide whether a migration is safe.

Select the Ruby interpreter with PassengerRuby

A VPS may contain a distribution Ruby, an rbenv Ruby, an RVM Ruby, or several versions at once. Passenger needs an explicit executable when the default command is not the one your app requires.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
  1. Use Passenger’s tooling and your Ruby installation method to determine the full path of the interpreter that can run the application.
  2. Run that Ruby as the deployment user and confirm it can load the application’s bundle.
  3. Place the absolute path in the virtual host’s PassengerRuby directive.

PassengerRuby selects the Ruby command for a specific application or virtual host. It is not a request to Passenger to choose the newest Ruby on the server. Pin the path deliberately, especially when the system Ruby and a version-managed Ruby coexist.

Configure an Apache virtual host for a root deployment

Create a site configuration using the Apache layout appropriate for your distribution. This is the minimal pattern for an application served at the hostname root:

<VirtualHost *:80>
    ServerName yourserver.com
    DocumentRoot /var/www/myapp/code/public
    PassengerRuby /path-to-ruby

    <Directory /var/www/myapp/code/public>
        Allow from all
        Options -MultiViews
        # Apache 2.4+: Require all granted
        Require all granted
    </Directory>
</VirtualHost>

Replace yourserver.com, /var/www/myapp/code/public, and /path-to-ruby. On Apache 2.4 and later, use Require all granted for authorization. The older Allow from all form is shown in Passenger’s pattern for older Apache configurations; do not rely on it instead of the 2.4 authorization directive.

Best Value
Sale
Under Desk Cable Management Tray No Drill, Metal Mesh Cable Management Under Desk with Clamp Mount, 2 Hole Cable Tray with Wire Management and Cord Organizer for Home Office Standing Desk
  • 【No Drill Mounted】Cable management tray can be assembled in as little as 3 minutes or less-simply. Side clips easily clampe the edge of desk, pass through the holes on the sides, and secure excess cables with baskets. Desk cable management supports inward or outward installation to meet your needs in different scenarios, and provides you with great convenience when collecting and organizing wires.
  • 【Rubber Pad Protects Desk】Wire organizer under desk built-in soft rubber pads on the clamp protect your desk from scratches, so you will not damage your furniture or office.
  • 【Sturdy and Beautiful】Cord management under desk is made of high-quality carbon steel and holds about 15 lbs. The wire basket has 2 holes on each side of the tray to enable your cables to pass freely. Cable baskets are suitable for desk thickness use from 0.4" to 2.4".
  • 【Space Saving & Keep Organized】Desk cable management tray holds all your power cords, outlet strips, USB hubs and computer transformers hidden from your feet, and the data cables will not enter the vacuum cleaner to keep your desk clean and tidy. Desk wire organizer is also suitable for use in the kitchen and outdoors.
  • 【Reduce Safety Risks】Cable tray under desk keeps all plugs away from your kids, no more worry about tripping. Using 2 holes wire tray saves extra space, helps you easily cabling and wire protection. The mesh design is not easy to accumulate dust, but avoids safety accidents caused by messy wires.

What each directive does

Directive Purpose Value to check
ServerName Associates requests for a hostname with this virtual host. The public DNS name you intend to use.
DocumentRoot Sets the web root Apache exposes and the location Passenger treats as the application entry point. The Rails app’s public directory, not the repository root.
PassengerRuby Selects the Ruby executable for this app or virtual host. The full path to the Ruby that has the app’s bundle.
<Directory> Applies access and option rules to the public directory. Exactly the same public path as DocumentRoot.
Options -MultiViews Disables Apache content negotiation that can interfere with Rails route handling. Keep it in the public-directory block.
Require all granted Allows Apache 2.4 to serve the directory. Use it for Apache 2.4 or newer.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Serve a Rails app below a sub-URI

A sub-URI deployment, such as serving an app below /myapp on an existing hostname, requires more than changing DocumentRoot. Passenger’s Apache reference uses an Alias, PassengerBaseURI, and PassengerAppRoot in a Location block, plus a matching Directory block for the app’s public directory.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Alias /myapp /var/www/myapp/code/public

<Location /myapp>
    PassengerBaseURI /myapp
    PassengerAppRoot /var/www/myapp/code
</Location>

<Directory /var/www/myapp/code/public>
    Options -MultiViews
    Require all granted
</Directory>

Adapt the URI and filesystem paths to your application, and follow the Passenger reference for the complete sub-URI arrangement. The application itself may also need a matching asset and URL configuration; Apache cannot correct Rails-generated links that assume the app is mounted at the hostname root.

Enable the site, check syntax, and restart Apache

  1. Place the virtual-host file in the distribution’s Apache sites or configuration directory.
  2. Enable the site with the distribution’s Apache tooling when that tooling is available.
  3. Check the Apache configuration before restarting. Use the configuration-test command provided by your distribution, such as the appropriate apachectl or apache2ctl syntax-test operation.
  4. Correct every reported error, including an incorrect Ruby path, missing Passenger module, duplicate virtual host, or malformed directory block.
  5. Restart Apache with the service manager or Apache command used by the distribution.

The Passenger deployment guide calls for an Apache restart after adding the virtual host. A restart that fails is a configuration problem; do not continue to application debugging until Apache starts cleanly.

Verify DNS, Apache, Passenger, and Rails separately

Test in layers so that a failure points to the right component.

  1. Check name resolution. Confirm that the hostname resolves to the VPS address. If DNS still points elsewhere, the correct virtual host will not receive the request.
  2. Request the hostname. Confirm that you see the Rails application rather than Apache’s default page. A default page usually means the intended virtual host is not enabled, the hostname does not match ServerName, or the request reached another server.
  3. Check Apache’s startup result. A clean restart establishes that the configuration parses and the Passenger module can load.
  4. Check Passenger’s status and troubleshooting tools. Use the Passenger commands appropriate to the installed version when the app fails to boot or remains unavailable.
  5. Read Apache and application logs. Look for bundle errors, missing environment variables, database connection failures, permission errors, and exceptions raised during Rails boot.
  6. Test a Rails route and a static asset. This distinguishes an application boot problem from an asset or routing problem.

The installation validation command proves that Passenger is integrated with Apache. It does not prove that this application’s Ruby, gems, secrets, database, and assets are correct.

What’s actually slowing this PC down?

Pick the symptom - the matching free tool is one click away.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Troubleshoot the common failure branches

Symptom Likely area Checks and corrective action
Apache will not restart Syntax or module configuration Run the distribution’s Apache configuration test, inspect the exact error, and verify the generated Passenger LoadModule and PassengerRoot directives.
Passenger validation fails Passenger installation or prerequisites Confirm the selected installation route completed, required packages are present, and Apache was restarted before running sudo /usr/bin/passenger-config validate-install.
Apache shows its default page Virtual-host selection Check that the site is enabled, ServerName matches the request, DNS points to this VPS, and another enabled site is not taking precedence.
403 Forbidden for public files Directory authorization or filesystem access Verify the <Directory> path matches DocumentRoot, use Require all granted on Apache 2.4+, and check that Apache can traverse the parent directories.
Routes return unexpected file or redirect behavior Apache content negotiation Ensure Options -MultiViews is present in the public-directory block.
Application cannot boot or gems are missing Ruby selection or bundle Compare the Ruby used to install the bundle with the absolute path in PassengerRuby; then inspect the Rails and Apache logs.
Database errors during boot or requests Database service or environment Confirm the required database service is running, credentials are available to the deployment user, and the release’s migration procedure has been completed.
Assets are missing Release preparation Run the application’s required asset compilation step and confirm the files are under the deployed public tree.

Root deployment versus sub-URI deployment

Decision Root virtual host Sub-URI
URL shape The app owns the hostname, such as yourserver.com. The app is mounted below a path such as yourserver.com/myapp.
Apache setup A VirtualHost with DocumentRoot ending in public. An Alias, PassengerBaseURI, PassengerAppRoot, and matching directory rules.
Complexity Simpler routing and fewer URL assumptions. Useful for multiple apps on one hostname but requires matching Rails and asset configuration.

System Ruby versus a version-managed Ruby

Using the distribution Ruby can simplify package integration, while rbenv or RVM can pin the interpreter required by an application. The operational requirement is the same in either case: Passenger must be pointed at the Ruby that owns the production bundle.

  • Choose the system Ruby when the application’s supported version matches the distribution and simplicity is more important than independent Ruby version control.
  • Choose a version-managed Ruby when the application requires a specific interpreter or several applications need different versions.
  • In both cases, record the full executable path and test it as the deployment user before editing PassengerRuby.

What this procedure does not provide

This deployment sequence gets Apache and Passenger serving a Rails application, but a public production service still needs operational decisions that are outside the cited installation and deployment examples:

  • HTTPS certificates and HTTP-to-HTTPS policy.
  • Firewall and SSH hardening.
  • Database backups and restore testing.
  • Application and server monitoring.
  • Log rotation and retention.
  • A repeatable release, rollback, and migration policy.
  • File-upload, secret-storage, and least-privilege decisions appropriate to the application.

Do not infer that Passenger validation or an Apache restart supplies any of these controls. Add them before treating the VPS as a finished production service.

Repeatable deployment checklist

  1. Provision a supported VPS and connect over SSH.
  2. Install Apache, Ruby, Rake, Git, build prerequisites, and the application’s database service.
  3. Install Passenger through the gem/module-build route or the current packaged repository route.
  4. Restart Apache and run sudo /usr/bin/passenger-config validate-install.
  5. Create a non-root deployment user and a persistent directory such as /var/www/myapp.
  6. Clone the application into a subdirectory such as /var/www/myapp/code using that user.
  7. Install the bundle, compile assets when required, configure secrets and environment variables, and prepare the database.
  8. Determine the exact Ruby executable Passenger must use.
  9. Set DocumentRoot to /var/www/myapp/code/public, set PassengerRuby, grant directory access, and disable MultiViews.
  10. Enable the virtual host, test Apache syntax, and restart Apache.
  11. Verify DNS, the hostname response, Passenger status, Apache logs, Rails logs, routes, and assets.
  12. Complete HTTPS, hardening, backups, monitoring, and release-management work before exposing the application as a production service.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.