我正在尝试设置新服务器,但 nginx 无法加载指令“passenger_enabled”。
May 03 11:35:28 xxxx nginx[11181]: nginx: [emerg] unknown directive "passenger_enabled" in /etc/nginx/sites-enabled/default:25
May 03 11:35:28 xxxx nginx[11181]: nginx: configuration file /etc/nginx/nginx.conf test failed
我认为我安装正确:
dorijan@xxxxxx:/etc/nginx/sites-enabled$ sudo apt-get install -y nginx-extras passenger
Reading package lists... Done
Building dependency tree
Reading state information... Done
nginx-extras is already the newest version (1.14.0-0ubuntu1).
passenger is already the newest version (5.0.30-1build2).
在 nginx.conf 中我有
...包括/etc/nginx/conf.d/.conf;包括 /etc/nginx/sites-enabled/;包括 /etc/nginx/passenger.conf;...
并且 /etc/nginx/passenger.conf 包含:
dorijan@xxxxxx:/etc/nginx$ cat passenger.conf
passenger_ruby /home/dorijan/.rvm/wrappers/ruby-2.5.0/ruby;
passenger_root /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini;
默认站点配置为:
server {
listen 80 default_server;
listen [::]:80 default_server;
server_name xxxx.local;
passenger_enabled on;
rails_env development;
root /home/dorijan/ruby/xxxxx/public;
}
知道哪里出了问题吗?谢谢
答案1
我猜 bionic 存储库中还没有包含乘客模块的 nginx 软件包,对吧?你可能需要通过以下方式检查你的 nginx 中是否包含该模块
nginx -V
我也没有在任何地方找到合适的 libnginx-mod-http-passenger。
答案2
sudo apt install -y nginx
按照说明操作后,仍然需要安装 nginxhttps://www.phusionpassenger.com/library/walkthroughs/deploy/ruby/ownserver/nginx/oss/bionic/install_passenger.html