I'm trying to install Phusion Passenger as a dynamic module with Nginx installed from the repo. The process seems to be working but my Meteor app doesn't load and it looks like the Passenger module isn't running.
OS: RedHat 8
Nginx: 1.20.1
Passenger: Standalone 6.0.12
Meteor: 2.5.1
How I've built the module:
-
Install Passenger standalone as per the tutorial
-
Install passenger-devel
sudo dnf install passenger-devel.x86_64
- Check installation
sudo /usr/bin/passenger-config validate-install
This shows "Everything looks good"
- Check the Passenger module path
passenger-config --nginx-addon-dir
returns
/usr/share/passenger/ngx_http_passenger_module
and
sudo ls /usr/share/passenger/ngx_http_passenger_module
shows
config ContentHandler.c ngx_http_passenger_module.c StaticContentHandler.h
ConfigGeneral ContentHandler.h ngx_http_passenger_module.h
Configuration.c LocationConfig README.md
Configuration.h MainConfig StaticContentHandler.c
- Install PCRE
sudo yum install pcre-devel
- Install Nginx from repo
sudo yum module list nginx
sudo yum module reset nginx
sudo yum module enable nginx:1.20
sudo yum install nginx
sudo systemctl enable nginx
- Download Nginx source code
wget https://nginx.org/download/nginx-1.20.1.tar.gz
tar zxf nginx-1.20.1.tar.gz
cd nginx-1.20.1/
- Check compile flags:
nginx -V
- Used the output of
nginx -Vto construct and then run theconfigurecommand (though as the output showed --wtih-compat I could probably have used./configure --with-compat --add-dynamic-module=$(passenger-config --nginx-addon-dir)instead)
./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/./configure --prefix=/usr/share/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --http-client-body-temp-path=/var/lib/nginx/tmp/client_body --http-proxy-temp-path=/var/lib/nginx/tmp/proxy --http-fastcgi-temp-path=/var/lib/nginx/tmp/fastcgi --http-uwsgi-temp-path=/var/lib/nginx/tmp/uwsgi --http-scgi-temp-path=/var/lib/nginx/tmp/scgi --pid-path=/run/nginx.pid --lock-path=/run/lock/subsys/nginx --user=nginx --group=nginx --with-compat --with-debug --with-file-aio --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_degradation_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_perl_module=dynamic --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail=dynamic --with-mail_ssl_module --with-pcre --with-pcre-jit --with-stream=dynamic --with-stream_ssl_module --with-stream_ssl_preread_module --with-threads --add-dynamic-module=$(passenger-config --nginx-addon-dir)
- Build the Passenger module and copy it to where Nginx can find it
make modules
sudo cp objs/ngx_http_passenger_module.so /usr/share/nginx/modules/
- Tell Nginx to load the module
sudo nano /etc/nginx/nginx.conf
user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log info;
pid /run/nginx.pid;
# Load dynamic modules. See /usr/share/doc/nginx/README.dynamic.
load_module "/usr/share/nginx/modules/ngx_http_passenger_module.so";
include /usr/share/nginx/modules/*.conf;
I also commented out the default server block.
- Configure my app (which is already unpacked in /var/www/myapp and I know from previous tests that it works with Nginx and Passenger installed from the repo)
sudo nano /etc/nginx/conf.d/myapp.conf
Extract from the conf file:
server {
listen 80;
server_name myserveraddress;
# Tell Nginx and Passenger where your app's 'public' directory is
root /var/www/myapp/bundle/public;
# Turn on Passenger
passenger_enabled on;
passenger_startup_file main.js;
passenger_app_root /var/www/myapp/bundle;
...
- Restart nginx
sudo service nginx restart
I now visit the web page but see a 404 not found page. In the logs I see only this:
"/var/www/myapp/bundle/public/index.html" is not found (2: No such file or directory)
There are no other errors, warnings or info.
This suggests to me that Nginx is loading my config file or it wouldn't be looking in /var/www/myapp/bundle. But it doesn't seem to have enabled Passenger, as it's still looking for public/index.html instead of main.js.
I can't find any way to inspect Nginx to see what dynamic modules are running, and I've tried setting the log level to debug. I'd be grateful for any suggestions how to find out what's going on / how to enable the Passenger module?

所有评论(0)