为什么Phusion乘客把我的Apache2安装搞砸了?

为什么Phusion乘客把我的Apache2安装搞砸了?,apache2,passenger,Apache2,Passenger,几个月前我安装了Phusion Passenger,现在我刚刚启动Apache,我请求了一个位于/usr/local/apache2/htdocs中的页面: http://localhost:8080/2.htm 大约30秒后,我在浏览器中看到一个紫黑相间的乘客页面,上面写着: WEB APPLICATION COULD NOT BE STARTED Application root /Users/7stud/ruby_programs/phusion_passenger_progr

几个月前我安装了Phusion Passenger,现在我刚刚启动Apache,我请求了一个位于/usr/local/apache2/htdocs中的页面:

http://localhost:8080/2.htm
大约30秒后,我在浏览器中看到一个紫黑相间的乘客页面,上面写着:

WEB APPLICATION COULD NOT BE STARTED

Application root
    /Users/7stud/ruby_programs/phusion_passenger_programs/1app
但我不想启动位于以下位置的Sinatra应用程序:

/Users/7stud/ruby_programs/phusion_passenger_programs/1app
我想做的就是让Apache通过返回html页面2.htm来响应我的浏览器请求——就像我以前能够做的那样

以下是我为安装Phusion Passenger所做的工作:

~/ruby_programs/phusion_passenger_programs/1app$ passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v4.0.48.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

 1. The Apache 2 module will be installed for you.
 2. You'll learn how to configure Apache.
 3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.


--------------------------------------------

Which languages are you interested in?

Use <space> to select.
If the menu doesn't display correctly, press '!'

 ‣ ⬢  Ruby
   ⬢  Python
   ⬢  Node.js
   ⬡  Meteor

--------------------------------------------

Warning: some directories may be inaccessible by the web server!

The web server typically runs under a separate user account for security
reasons. That user must be able to access the Phusion Passenger files.
However, it appears that some directories have too strict permissions. This
may prevent the web server user from accessing Phusion Passenger files.

It is recommended that you relax permissions as follows:

  sudo chmod o+x "/Users/7stud"

Press Ctrl-C to return to the shell. (Recommended)
After relaxing permissions, re-run this installer.


***I CHANGED PERMISSIONS, THEN RERAN INSTALLER****

…
…

Sanity checking Apache installation...
Multiple Apache installations detected!

You are about to install Phusion Passenger against the following
Apache installation:

  Apache 2.2.24
  apxs2     : /usr/sbin/apxs
  Executable: /usr/sbin/httpd

However, 1 other Apache installation(s) have been found on your system:

  * Apache 2.4.3
    apxs2     : /usr/local/apache2/bin/apxs
    Executable: /usr/local/apache2/bin/httpd

Are you sure you want to install against Apache 2.2.24 (/usr/sbin/apxs)? [y/n]: n

--------------------------------------------

 * To compile against Apache 2.4.3 (/usr/local/apache2/bin/apxs):
   Re-run this installer with: --apxs2-path "/usr/local/apache2/bin/apxs"

You may also want to read the "Installation" section of the manual for
installation troubleshooting:

***I RERAN INSTALLER AGAIN***

$ passenger-install-apache2-module --apxs2-path "/usr/local/apache2/bin/apxs"

…
…

Sanity checking Apache installation...
Multiple Apache installations detected!

You are about to install Phusion Passenger against the following
Apache installation:

  Apache 2.4.3
  apxs2     : /usr/local/apache2/bin/apxs
  Executable: /usr/local/apache2/bin/httpd

However, 1 other Apache installation(s) have been found on your system:

  * Apache 2.2.24
    apxs2     : /usr/sbin/apxs
    Executable: /usr/sbin/httpd

Are you sure you want to install against Apache 2.4.3 (/usr/local/apache2/bin/apxs)? [y/n]: y

===LOT'S OF OUTPUT HERE FOR COMPILATION, THEN ERRORED OUT:

Undefined symbols:
  "___fork", referenced from:
      Passenger::asyncFork()     in Utils.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
rake aborted!
Command failed with status (1): [c++ buildout/agents/PassengerHelperAgent.o -o buildout/agents/PassengerHelperAgent buildout/common/libpassenger_common/Logging.o buildout/common/libpassenger_common/Exceptions.o buildout/common/libpassenger_common/Utils/SystemTime.o buildout/common/libpassenger_common/Utils/StrIntUtils.o buildout/common/libpassenger_common/Utils/IOUtils.o buildout/common/libpassenger_common/Utils.o buildout/common/libpassenger_common/Utils/Base64.o buildout/common/libpassenger_common/Utils/CachedFileStat.o buildout/common/libpassenger_common/Utils/LargeFiles.o buildout/common/libpassenger_common/ApplicationPool2/Implementation.o buildout/common/libpassenger_common/ApplicationPool2/AppTypes.o buildout/common/libpassenger_common/AgentsBase.o buildout/common/libpassenger_common/Utils/MD5.o buildout/common/libpassenger_common/Utils/fib.o buildout/common/libpassenger_common/Utils/jsoncpp.o buildout/common/libboost_oxt.a   buildout/libev/.libs/libev.a buildout/libeio/.libs/libeio.a -lpthread -Wl,-dead_strip  ]
/Users/7stud/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.48/build/cplusplus_support.rb:51:in `run_compiler'
/Users/7stud/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.48/build/cplusplus_support.rb:77:in `create_executable'
/Users/7stud/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.48/build/agents.rb:101:in `block in <top (required)>'
/Users/7stud/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/Users/7stud/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => apache2 => buildout/agents/PassengerHelperAgent
(See full trace by running task with --trace)

--------------------------------------------

It looks like something went wrong

Please read our Users guide for troubleshooting tips:

   /Users/7stud/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.48/doc/Users guide Apache.html
   https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html

If that doesn't help, please use our support facilities. We'll do our best to help you.

   https://www.phusionpassenger.com/documentation_and_support


==========

The error is because Passenger no longer supports Snow Leopard.

Next I uninstalled the current passenger gem:

$ gem uninstall passenger -v 4.0.48

and installed version 4.0.5

$ gem install passenger -v 4.0.5

Then:

$ passenger-install-apache2-module --apxs2-path "/usr/local/apache2/bin/apxs"

And passenger installed successfully:

====

The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /Users/7stud/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.5/libout/apache2/mod_passenger.so
   PassengerRoot /Users/7stud/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.5
   PassengerDefaultRuby /Users/7stud/.rvm/wrappers/ruby-2.1.2/ruby

***I MODIFIED apache2/conf/http.conf ACCORDING TO THE ABOVE***

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!

Press ENTER to continue.


--------------------------------------------
Deploying a Ruby on Rails application: an example

Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:

   <VirtualHost *:80>
      ServerName www.yourhost.com
      # !!! Be sure to point DocumentRoot to 'public'!
      DocumentRoot /somewhere/public    
      <Directory /somewhere/public>
         # This relaxes Apache security settings.
         AllowOverride all
         # MultiViews must be turned off.
         Options -MultiViews
      </Directory>
   </VirtualHost>

And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

  /Users/7stud/.rvm/gems/ruby-2.1.2/gems/passenger-4.0.5/doc/Users guide Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
https://www.phusionpassenger.com

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.
…并且卸载文档不会告诉您如果使用安装程序安装,如何卸载。太好了

所以,如果我只是注释掉httpd.conf文件中提到Phusion乘客的任何内容,那么我应该没事,对吧?我这样做了,然后重新启动了apache2,现在我尝试访问的每个页面(在apache2/htdocs目录中)的URL如下:

http://localhost:8080/2.htm
我得到:

Not Found

The requested URL /2.htm was not found on this server.
Not Found

The requested URL /2.htm was not found on this server.
然而:

多亏了Phusion乘客,我再也不能让apache提供页面了

下一步,卸载乘客宝石:

$ gem uninstall passenger
Remove executables:
    passenger, passenger-install-apache2-module, passenger-install-nginx-module, passenger-config, passenger-status, passenger-memory-stats

in addition to the gem? [Yn]  Y
Removing passenger
Removing passenger-install-apache2-module
Removing passenger-install-nginx-module
Removing passenger-config
Removing passenger-status
Removing passenger-memory-stats
Successfully uninstalled passenger-4.0.5

同样的结果。重新启动我的电脑。同样的结果。Apache2不再提供页面。

我可以通过更改Apache2/conf/http.conf中的以下行来使Apache重新工作:

Listen 8080

显然,Phusion乘客不知何故永久性地破坏了8080端口

奇怪的是,如果我将端口改回8080,停止apache,启动apache,然后使用url
http://localhost:8181/2.htm
,apache仍然提供该页面。嗯

如果我使用url:
http://localhost:8080/2.htm
,我把通常的Phusion乘客搞砸了:

$ gem uninstall passenger
Remove executables:
    passenger, passenger-install-apache2-module, passenger-install-nginx-module, passenger-config, passenger-status, passenger-memory-stats

in addition to the gem? [Yn]  Y
Removing passenger
Removing passenger-install-apache2-module
Removing passenger-install-nginx-module
Removing passenger-config
Removing passenger-status
Removing passenger-memory-stats
Successfully uninstalled passenger-4.0.5
Listen 8080
Listen 8181
Not Found

The requested URL /2.htm was not found on this server.