为什么Phusion Passenger搞砸我的Apache2安装?

时间:2014-10-13 02:51:37

标签: apache2 passenger

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

http://localhost:8080/2.htm

大约30秒后,我的浏览器中出现了一个紫色和黑色的Phusion Passenger页面,说明:

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文件中的一些相关部分:

<Directory />
    AllowOverride none
    Require all denied
</Directory>

DocumentRoot "/usr/local/apache2/htdocs"

<Directory "/usr/local/apache2/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride None
    Require all granted
</Directory>

<Directory "/Users/7stud/ruby_programs/phusion_passenger_programs">
    Options Indexes FollowSymLinks MultiViews 
    AllowOverride None 
    Order allow,deny 
    Allow from all 
</Directory>

<Directory "/usr/local/apache2/cgi-bin">
    AllowOverride None
    Options None
    Require all granted
</Directory>

修改

我决定摆脱Phusion Passenger,所以我在这里阅读了卸载文档:

https://www.phusionpassenger.com/documentation/Users%20guide%20Apache.html#uninstalling

我使用安装程序安装:

$ passenger-install-apache2-module

...如果您使用安装程序安装,则卸载文档不会告诉您如何卸载。大!

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

http://localhost:8080/2.htm

我明白了:

Not Found

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

然而:

/usr/local/apache2/bin$ sudo ./apachectl -k stop
Password:
/usr/local/apache2/bin$ sudo ./apachectl -k start
/usr/local/apache2/bin$ cd ../htdocs
/usr/local/apache2/htdocs$ ls
1.htm           html.html       mysql2.php
1.php           index.html      page1.html
2.htm           js.js           page2.html
2.php           js2.js          q
3.htm           js3.js          test.html
4.htm           lib         test.php
A.html          mail.php        xhr.js
B.html          my.htm          xml2.xml
css         my_manifest.appcache
home.html       mysql.php

感谢Phusion Passenger,我再也无法通过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不再提供页面。

1 个答案:

答案 0 :(得分:0)

通过更改apache2 / conf / http.conf中的以下行,我能够让Apache再次工作:

Listen 8080

Listen 8181

显然,Phusion Passenger已经不知何故永久地搞砸了8080端口。

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

如果我使用网址:http://localhost:8080/2.htm,我会让普通的Phusion Passenger搞砸了:

Not Found

The requested URL /2.htm was not found on this server.
相关问题