{"id":4498,"date":"2025-08-30T16:50:27","date_gmt":"2025-08-30T07:50:27","guid":{"rendered":"https:\/\/www.kinryo.net\/?p=4498"},"modified":"2025-08-30T16:58:43","modified_gmt":"2025-08-30T07:58:43","slug":"%ef%bc%91%ef%bc%93%ef%bc%9aweb%e3%82%b5%e3%83%bc%e3%83%90%e3%83%bc%e3%82%92apache%e3%81%ab%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/www.kinryo.net\/?p=4498","title":{"rendered":"\uff11\uff13\uff1aWEB\u30b5\u30fc\u30d0\u30fc\u3092apache\u306b\u3059\u308b"},"content":{"rendered":"<p>\u73fe\u6642\u70b9\u3067\u306fdevelopment mode\u3060\u304c\u3001production mode \u3067\u306fapache\u3092\u4f7f\u3046\u3064\u3082\u308a\u3060\u3002\u305f\u3060\u4f5c\u3063\u3066\u3044\u308b\u30a2\u30d7\u30ea\u306e\u30ab\u30e9\u30e0\u304c30\u4ee5\u4e0a\u3082\u3042\u308a\u3001WEB\u306e\u8868\u793a\u3092\u753b\u9762\u5168\u4f53\u3067\u898b\u305f\u3044\u306e\u3067\u3001\u5148\u306bapache\u3067\u898b\u308c\u308b\u3088\u3046\u306b\u3059\u308b\u305f\u3081\u306b gem\u306epassenger\u3092\u5165\u308c\u3066\u3001apache\u3067\u8868\u793a\u51fa\u304d\u308b\u3088\u3046\u306b\u3059\u308b\u3002<span style=\"color: #800080;\">(\u6ce8\uff1arails\u30a2\u30d7\u30ea\u306e\u516c\u958b\u306f\u793e\u5185\u3060\u3051\u306b\u3057\u3001\u30c6\u30ec\u30ef\u30fc\u30af\u306e\u793e\u54e1\u306fVPN\u3067\u793e\u5185\u30cd\u30c3\u30c8\u30ef\u30fc\u30af\u306b\u5165\u308a\u3001\u30ed\u30fc\u30ab\u30ebIP\u30a2\u30c9\u30ec\u30b9:3000\u3067\u30a2\u30af\u30bb\u30b9\u51fa\u6765\u308b\u3088\u3046\u306b\u3059\u308b\u306e\u3067\u3001\u6697\u53f7\u5316\u306f\u3057\u3066\u3044\u306a\u3044\uff09<\/span>\u307e\u305a\u306fGemfile \u306bpassenger\u3092\u5165\u308c\u308b<br \/>\n<span style=\"color: #ff6600;\">[fuji@rails8 TourData]$<\/span> <span style=\"color: #008000;\">gedit Gemfile<\/span><br \/>\n\u524d\u7565<br \/>\n<span style=\"color: #0000ff;\"># gem &#8220;image_processing&#8221;, &#8220;~&gt; 1.2&#8221;<\/span><br \/>\n<span style=\"color: #0000ff;\">gem &#8220;spring-commands-rspec&#8221;<\/span><br \/>\n<span style=\"color: #0000ff;\">gem &#8220;passenger&#8221;<\/span>\u3000\u3000\u3000\u3000\u3000\u2190 \u3053\u308c\u3092\u8ffd\u8a18<\/p>\n<p><span style=\"color: #0000ff;\">group :development, :test do<\/span><br \/>\n<span style=\"color: #0000ff;\"># See https:\/\/guides.rubyonrails.org\/debugging_rails_applications.html#debugging-with-the-debug-gem<\/span><br \/>\n<span style=\"color: #0000ff;\">gem &#8220;debug&#8221;, platforms: %i[ mri windows ], require: &#8220;debug\/prelude&#8221;<\/span><br \/>\n\u5f8c\u7565<br \/>\n\u3067\u3001\u304a\u6c7a\u307e\u308a\u306e<br \/>\n<span style=\"color: #ff6600;\">[fuji@rails8 TourData]$ <span style=\"color: #008000;\">bundle<\/span><br \/>\n<span style=\"color: #333333;\">apache\u306bpassenger\u3092\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3059\u308b\u304c\u305d\u306e\u524d\u306bhome\u30c7\u30ec\u30af\u30c8\u30ea\u30fc\u3092\u7b2c\u4e09\u8005\u304c\u5b9f\u884c\u51fa\u6765\u308b\u3088\u3046\u306b\u3057\u3066\u304a\u304f\u3002<\/span><br \/>\n<span><span style=\"color: #ff6600;\">[fuji@rails8 TourData]$<\/span> <span style=\"color: #008000;\">chmod<\/span><\/span><span style=\"color: #008000;\"> o+x\/home\/fuji<\/span><br \/>\n[fuji@rails8 TourData]$ <span style=\"color: #008000;\">passenger-install-apache2-modules<br \/>\n<\/span><\/span><\/p>\n<pre><code><span style=\"color: #ff6600;\">\r\nThis installer will guide you through the entire installation process. It\r\nshouldn't take more than 3 minutes in total.\r\n\r\nHere's what you can expect from the installation process:\r\n\r\n 1. The Apache 2 module will be installed for you.\r\n 2. You'll learn how to configure Apache.\r\n 3. You'll learn how to deploy a Ruby on Rails application.\r\n\r\nDon't worry if anything goes wrong. This installer will advise you on how to\r\nsolve any problems.\r\n\r\nPress Enter to continue, or Ctrl-C to abort.\u3000<span style=\"color: #008000;\">Enter\u3092\u30aa\u30b9<\/span><\/span><\/code><\/pre>\n<pre><code><span style=\"color: #ff6600;\">Which languages are you interested in?\r\n\r\nUse &lt;space&gt; to select.\r\nIf the menu doesn't display correctly, press '!'\r\n\r\n \u2023 \u2b22  Ruby\u3000\u3000\u3000\u3000\u3000<span style=\"color: #333333;\">Ruby\u306b\u4e09\u89d2\u304c\u4ed8\u3044\u3066\u3044\u308b\u306e\u3092\u78ba\u8a8d\u5f8c Enter<\/span>\r\n   \u2b21  Python\r\n   \u2b22  Node.js<\/span><\/code><\/pre>\n<p><span style=\"color: #ff6600;\"><span style=\"color: #008000;\"><\/span><\/span>\u8272\u3005\u8db3\u308a\u306a\u3044\u3082\u306e\u304c\u8868\u793a\u3055\u308c\u305f\u304c\u8a18\u9332\u304c\u7121\u304f\u306a\u3063\u3066\u3044\u308b\u306e\u3067\u3001\u4f55\u304c\u4e0d\u8db3\u3057\u3066\u3044\u305f\u304b\u306f\u601d\u3044\u51fa\u305b\u306a\u3044\u304c\u3001\u3068\u3082\u304b\u304fyum install &#8230;&#8230;.\u306a\u3069\u3068\u8a00\u3063\u3066\u304f\u308c\u308b\u306e\u3067\u305d\u306e\u901a\u308a\u306b\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u3001\u518d\u5ea6<br \/>\n<span><span style=\"color: #ff6600;\">[fuji@rails8 TourData]$<\/span> <span style=\"color: #008000;\">passenger-install-apache2-modules<br \/>\n<span style=\"color: #333333;\">\u3067\u3001\u6700\u5f8c\u306e\u65b9\u3067<br \/>\n<\/span><\/span><\/span><span style=\"color: #ff6600;\">Almost there!<\/span><br \/>\n<span style=\"color: #ff6600;\">Please edit your Apache configuration file, and add these lines:<\/span><\/p>\n<p><span style=\"color: #ff6600;\">LoadModule passenger_module \/home\/fuji\/.rbenv\/versions\/3.2.9\/lib\/ruby\/gems\/3.2.0\/gems\/passenger-6.0.27\/buildout\/apache2\/mod_passenger.so<\/span><br \/>\n<span style=\"color: #ff6600;\">&lt;IfModule mod_passenger.c&gt;<\/span><br \/>\n<span style=\"color: #ff6600;\">\u3000PassengerRoot \/home\/fuji\/.rbenv\/versions\/3.2.9\/lib\/ruby\/gems\/3.2.0\/gems\/passenger-6.0.27<\/span><br \/>\n<span style=\"color: #ff6600;\">\u3000PassengerDefaultRuby \/home\/fuji\/.rbenv\/versions\/3.2.9\/bin\/ruby<\/span><br \/>\n<span style=\"color: #ff6600;\">&lt;\/IfModule&gt;<\/span><\/p>\n<p><span style=\"color: #ff6600;\">After you restart Apache, you are ready to deploy any number of web<\/span><br \/>\n<span style=\"color: #ff6600;\">applications on Apache, with a minimum amount of configuration!<\/span><\/p>\n<p><span style=\"color: #ff6600;\">Press ENTER when you are done editing.<\/span><\/p>\n<p><span style=\"color: #ff6600;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><br \/>\n<span style=\"color: #ff6600;\">Validating installation&#8230;<\/span><br \/>\n<span style=\"color: #ff6600;\">* Checking whether this Passenger install is in PATH&#8230; \u2713<\/span><br \/>\n<span style=\"color: #ff6600;\">* Checking whether there are no other Passenger installations&#8230; \u2713<\/span><br \/>\n<span style=\"color: #ff6600;\">* Checking whether Apache is installed&#8230; \u2713<\/span><br \/>\n<span style=\"color: #ff6600;\">* Checking whether the Passenger module is correctly configured in Apache&#8230; (!)<\/span><\/p>\n<p><span style=\"color: #ff6600;\">You did not specify &#8216;LoadModule passenger_module&#8217; in any of your Apache<\/span><br \/>\n<span style=\"color: #ff6600;\">configuration files. Please paste the configuration snippet that this<\/span><br \/>\n<span style=\"color: #ff6600;\">installer printed earlier, into one of your Apache configuration files, such<\/span><br \/>\n<span style=\"color: #ff6600;\">as \/etc\/httpd\/conf\/httpd.conf.<\/span><\/p>\n<p><span style=\"color: #ff6600;\">Detected 0 error(s), 1 warning(s).<\/span><br \/>\n<span style=\"color: #ff6600;\">Press ENTER to continue.<\/span><\/p>\n<p><span style=\"color: #ff6600;\">&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;<\/span><br \/>\n<span style=\"color: #ff6600;\">Deploying a web application<\/span><\/p>\n<p><span style=\"color: #ff6600;\">To learn how to deploy a web app on Passenger, please follow the deployment<\/span><br \/>\n<span style=\"color: #ff6600;\">guide:<\/span><\/p>\n<p><span style=\"color: #ff6600;\">https:\/\/www.phusionpassenger.com\/library\/deploy\/apache\/deploy\/<\/span><\/p>\n<p><span style=\"color: #ff6600;\">Enjoy Phusion Passenger, a product of Phusion\u00ae (www.phusion.nl) \ud83d\ude42<\/span><br \/>\n<span style=\"color: #ff6600;\">https:\/\/www.phusionpassenger.com<\/span><\/p>\n<p><span style=\"color: #ff6600;\">Passenger\u00ae is a registered trademark of Asynchronous B.V.<\/span><\/p>\n<p><span><span style=\"color: #008000;\"><span style=\"color: #333333;\">Checking whether the Passenger module is correctly configured in Apache&#8230; (!) \u3060\u3051\u304c\u30a8\u30e9\u30fc\u306b\u306a\u3063\u3066\u3044\u308b\u3002\u5f53\u305f\u308a\u524d\u3060\u3001\u30a4\u30f3\u30b9\u30c8\u30fc\u30eb\u3057\u305f\u3060\u3051\u306a\u306e\u3067\u8a2d\u5b9a\u306f\u7d42\u308f\u3063\u3066\u3044\u306a\u3044\u3002<br \/>\n\u307e\u305a\u306fpassenger module \u3092\u30ed\u30fc\u30c9\u3059\u308b\u304c\u3053\u308c\u306f<br \/>\n<\/span><\/span><\/span><span style=\"color: #ff6600;\">[root@rails8 ~]#<\/span> <span style=\"color: #008000;\">gedit \/etc\/httpd\/conf.modules.d\/00-rails.conf<\/span><br \/>\n<span style=\"color: #0000ff;\">LoadModule passenger_module \/home\/fuji\/.rbenv\/versions\/3.2.9\/lib\/ruby\/gems\/3.2.0\/gems\/passenger-6.0.27\/buildout\/apache2\/mod_passenger.so<\/span><br \/>\n<span style=\"color: #0000ff;\">PassengerEnabled on<\/span><br \/>\n<span style=\"color: #0000ff;\">&lt;IfModule mod_passenger.c&gt;<\/span><br \/>\n<span style=\"color: #0000ff;\">\u3000PassengerRoot \/home\/fuji\/.rbenv\/versions\/3.2.9\/lib\/ruby\/gems\/3.2.0\/gems\/passenger-6.0.27<\/span><br \/>\n<span style=\"color: #0000ff;\">\u3000PassengerDefaultRuby \/home\/fuji\/.rbenv\/versions\/3.2.9\/bin\/ruby<\/span><br \/>\n<span style=\"color: #0000ff;\">&lt;\/IfModule&gt;<br \/>\n<span style=\"color: #333333;\">\u3068\u8a2d\u5b9a\u3092\u65b0\u898f\u306b\u4f5c\u3063\u305f\u3002\u6b21\u306fdocument root\u306a\u3069\u306e\u8a2d\u5b9a\u3060\u304c\u3001\u3053\u308c\u306f\u65b0\u898f\u306b<br \/>\n<span style=\"color: #ff6600;\">[root@rails8 ~]# <\/span><span><\/span><span style=\"color: #008000;\">gedit \/etc\/httpd\/conf.d\/rails.conf<\/span><br \/>\n<\/span>DocumentRoot &#8220;\/Rails\/TourData\/public&#8221;<\/span><br \/>\n<span style=\"color: #0000ff;\">&lt;Directory &#8220;\/Rails\/TourData\/public&#8221;&gt;<\/span><br \/>\n<span style=\"color: #0000ff;\">\u3000AllowOverride None<\/span><br \/>\n<span style=\"color: #0000ff;\">\u3000# Allow open access:<\/span><br \/>\n<span style=\"color: #0000ff;\">\u3000Require all granted<\/span><br \/>\n<span style=\"color: #0000ff;\">&lt;\/Directory&gt;<\/span><br \/>\n<span style=\"color: #0000ff;\"><span style=\"color: #333333;\"><\/span><\/span>\u305d\u3057\u3066apache\u3092\u518d\u8d77\u52d5<br \/>\n<span style=\"color: #ff6600;\">[root@rails8 ~]# <\/span><span style=\"color: #008000;\">systemctl restart httpd<\/span><br \/>\n<span style=\"color: #ff6600;\">[root@rails8 ~]# <\/span><span style=\"color: #008000;\">systemctl status httpd<\/span><br \/>\n\u3067\u8d77\u52d5\u3092\u78ba\u8a8d<br \/>\n\u6b21\u306bpassenger\u306e\u8d77\u52d5<br \/>\n<span style=\"color: #ff6600;\">[fuji@rails8 TourData]$<\/span> <span style=\"color: #008000;\">passenger start &#8211;environment development<br \/>\n<\/span>\u3067passenger\u306f\u30b9\u30bf\u30fc\u30c8\u3057\u305f\u304c\u3001\u305d\u306e\u7aef\u672b\u306b<span style=\"color: #008000;\"><br \/>\n<span style=\"color: #ff6600;\">Started GET &#8220;\/metrics&#8221; for 127.0.0.1 at 2025-08-30 16:49:25 +0900<\/span><br \/>\n<span style=\"color: #ff6600;\">ActionController::RoutingError (No route matches [GET] &#8220;\/metrics&#8221;):<\/span><br \/>\n<\/span>\u3067\u3082\u30d6\u30e9\u30a6\u30b6\u3067\u3000http:\/\/IP \u30a2\u30c9\u30ec\u30b9:3000\u306b\u30a2\u30af\u30bb\u30b9\u3059\u308b\u3068apache\u3067\u30a2\u30af\u30bb\u30b9\u51fa\u6765\u308b<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u73fe\u6642\u70b9\u3067\u306fdevelopment mode\u3060\u304c\u3001production mode \u3067\u306fapache\u3092\u4f7f\u3046\u3064\u3082\u308a\u3060\u3002\u305f\u3060\u4f5c\u3063\u3066\u3044\u308b\u30a2\u30d7\u30ea\u306e\u30ab\u30e9\u30e0\u304c30\u4ee5\u4e0a\u3082\u3042\u308a\u3001WEB\u306e\u8868\u793a\u3092\u753b\u9762\u5168\u4f53\u3067\u898b\u305f\u3044\u306e\u3067\u3001\u5148\u306bapache\u3067\u898b\u308c\u308b\u3088 &hellip; <a href=\"https:\/\/www.kinryo.net\/?p=4498\">\u7d9a\u304d\u3092\u8aad\u3080 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"vkexunit_cta_each_option":"","footnotes":""},"categories":[28],"tags":[],"class_list":["post-4498","post","type-post","status-publish","format-standard","hentry","category-ruby-on-rails-almalinux9"],"acf":[],"_links":{"self":[{"href":"https:\/\/www.kinryo.net\/index.php?rest_route=\/wp\/v2\/posts\/4498","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.kinryo.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.kinryo.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.kinryo.net\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.kinryo.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=4498"}],"version-history":[{"count":6,"href":"https:\/\/www.kinryo.net\/index.php?rest_route=\/wp\/v2\/posts\/4498\/revisions"}],"predecessor-version":[{"id":4506,"href":"https:\/\/www.kinryo.net\/index.php?rest_route=\/wp\/v2\/posts\/4498\/revisions\/4506"}],"wp:attachment":[{"href":"https:\/\/www.kinryo.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=4498"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.kinryo.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=4498"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.kinryo.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=4498"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}