Ubuntu-Apache:乘客根本没有启动Rails应用程序



我正在使用Apache开发Ubuntu 16.04。我试着用Phusion Passeger启动我的rails应用程序。但该应用程序根本没有启动,如果我输入URL,我会得到HTML 403"您没有访问该服务器上/kainji/的权限":http://poyry.wo.local/kainji并且唯一登录other_vhosts_access.log:

poyry.wo.local:80 127.0.0.1 - - [13/Dec/2018:15:19:28 +0100] "GET /kainji/ HTTP/1.1" 403 513 "-" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36" 2265

我有以下文件在网站可用目录链接到网站启用目录:

<VirtualHost *:80>
ServerName poyry.wo.local
DocumentRoot /var/www/html/dev/rails
<Directory /var/www/html/dev/rails>
Options -Indexes
Allow from all
</Directory>
PassengerBaseURI /kainji
<Directory /var/www/html/dev/rails/v2p0-kanji/public>
RailsEnv    development
Options     -MultiViews
</Directory>
</VirtualHost>

如果我删除链接,我会得到HTML 404:"在这台服务器上找不到请求的URL/kainji。"什么是正确的。

在Apache错误日志中,我看到Passenger启动了:

[ 2018-12-12 14:17:41.8778 4321/7efdbb745780 age/Wat/WatchdogMain.cpp:1291 ]: Starting Passenger watchdog...
[ 2018-12-12 14:17:41.8885 4324/7f0b49b28780 age/Cor/CoreMain.cpp:982 ]: Starting Passenger core...
[ 2018-12-12 14:17:41.8886 4324/7f0b49b28780 age/Cor/CoreMain.cpp:235 ]: Passenger core running in multi-application mode.
[ 2018-12-12 14:17:41.8908 4324/7f0b49b28780 age/Cor/CoreMain.cpp:732 ]: Passenger core online, PID 4324
[ 2018-12-12 14:17:41.9045 4356/7fd543c3b780 age/Ust/UstRouterMain.cpp:529 ]: Starting Passenger UstRouter...
[ 2018-12-12 14:17:41.9051 4356/7fd543c3b780 age/Ust/UstRouterMain.cpp:342 ]: Passenger UstRouter online, PID 4356
[Wed Dec 12 14:17:42.201857 2018] [ssl:warn] [pid 4318] AH01909: centos1.tibi1959.hu:443:0 server certificate does NOT include an ID which matches the server name
[Wed Dec 12 14:17:42.209447 2018] [mpm_prefork:notice] [pid 4318] AH00163: Apache/2.4.18 (Ubuntu) Phusion_Passenger/5.0.29 OpenSSL/1.0.2g configured -- resuming normal operations
[Wed Dec 12 14:17:42.209484 2018] [core:notice] [pid 4318] AH00094: Command line: '/usr/sbin/apache2'

乘客安装的验证也可以:

$ /usr/bin/passenger-config validate-install
What would you like to validate?
Use <space> to select.
If the menu doesn't display correctly, press '!'
⬢  Passenger itself
‣ ⬢  Apache
-------------------------------------------------------------------------
Checking whether there are multiple Apache installations...
Only a single installation detected. This is good.
-------------------------------------------------------------------------
* Checking whether this Passenger install is in PATH... ✓
* Checking whether there are no other Passenger installations... ✓
* Checking whether Apache is installed... ✓
* Checking whether the Passenger module is correctly configured in Apache... ✓
Everything looks good. :-)

怎么了?

乍一看,我猜问题是由覆盖应用程序的静态文件服务引起的。

403错误是由于目录列表被禁用,并且没有可显示的index.html文件。

您可能想要更改设置静态文件服务的方式,因此url需要"public"文件夹名称。通过这种方式,您可以将应用程序服务器设置为路由到/kainji路径。

也许类似于:

```ServerName poyry.wo.localDocumentRoot/var/www/html/dev/rails/kainji/public

PassengerBaseURI/kainjiRailsEnv开发选项-多视图```

最新更新