For an existing rails app I would like to use Passenger without Nginx (because I already use Traefik as reverse-proxy / load balancer).
But passenger start always stats Nginx too. Sadly I'm neither an Passenger nor an Nginx expert.
How can I start passenger "standalone" ?
I'm using
Passenger 6.0.2
Rails 5.1.1
I'm starting passenger with ...
bundle exec passenger start -e production
There's no passengerconfig.json (...)
Reading the docs didn't help.
This is how I start the passenger
#!/bin/bash
bundle exec rake db:migrate RAILS_ENV=production
bundle exec passenger start -e production
When I check the processes using grep I see
nginx: master process /usr/local/bundle/gems/passenger-6.0.2/buildout/support-binaries/nginx-1.15.8 -c /tmp/passenger-standalone.184ibaq/nginx.conf -p /tmp/passenger-standalone.184ibaq
nginx: worker process
root
/usr/local/bundle/gems/passenger-6.0.2/buildout/support-binaries/PassengerAgent temp-dir-toucher /tmp/passenger-standalone.184ibaq --cleanup --daemonize --pid-file /tmp/passenger-standalone.184ibaq/temp_dir_toucher.pid --log-file /usr/src/app/log/passenger.3000.log --nginx-pid 27
Please help me how I can (re-)configure Passenger, so it skips Nginx.
I guess I found the solution myself:
passenger start -e production --engine=builtin
If you know a better solution, please let me know.
Related
I am very new to nginx, and I accidentally killed the nginx process and now it wont start. "sudo service nginx start" gives me no output but I can't see the process when I run "ps -aux". I may have done some change in some of the config files, but I think I managed to revert all my changes.
When I type sudo nginx -t I get:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
I have also checked all the files in /var/log/nginx, but they have not any logs since I killed the process.
Thanks in advance,
Markus
From your rpm -qa output it seems your OS is CentOS 7.x
To check the nginx status you should use:
systemctl status nginx
To start the nginx service use:
systemctl start nginx
If it returns error and won't start you could issue also a journalctl -xe to get additional information and see why the service didn't start
I am deploying a rails app using ubuntu, nginx, & passenger.
I have rails & passenger installed properly. So, I go to run:
rvmsudo passenger-install-nginx-module
This runs all the way through and tells me it was successful. However, I run nginx -v and it tells me that it is not installed. During Passenger's installation process, I specified it to use /etc/nginx instead of /opt/nginx. I can't continue with my application deployment because the following command won't work (unrecognized service)
sudo service nginx start
Wondering if anyone has encountered, or understands this issue.
If you specified /etc/nginx as prefix then your Nginx is installed in /etc/nginx/sbin/nginx. I think you meant to overwrite the system's Nginx, but that's actually not what you have done: you've only installed a completely seperate Nginx installation, into /etc/nginx. So now you have two instances:
/usr/sbin/nginx, which uses config file /etc/nginx/nginx.conf
/etc/nginx/sbin/nginx, which uses config file /etc/nginx/conf/nginx.conf
Are you on Debian or Ubuntu? If so, then the easiest way to overwrite your system's Nginx with a Phusion Passenger-enabled Nginx is not to use passenger-install-nginx-module, but to use the Debian packages provided by Phusion Passenger.
I am a newbie to centos commands and scripting.
Scenario:
I have installed ERPNEXT and is working okay on the server but I have to do it manually by doing ./lib/wnfy.py --serve
What I want to do is to start it automatically using supervisord. I have gunicorn and nginx installed. Upon trying to start supervisord here's the error:
[root#vps3 etc]# chkconfig supervisord on [root#vps3 etc]# service
supervisord start /etc/init.d/supervisord: line 11:
./etc/rc.d/init.d/functionsprog=supervisord: No such file or directory
Starting : daemon --pidfile [ -f ]/etc/init.d/supervisord: line 14:
success: command not found /etc/init.d/supervisord: line 14: failure:
command not found
I am not yet familiar with how things work. Please advise. Thanks in advance.
Have you installed supervisor? Follow,
Install supervisor
Initscripts (use jkoppe ones).
Also for production setup, use gunicorn. Supervisor config for it is,
[program:gunicorn]
command=gunicorn -b 127.0.0.1:8000 -w 2 -t 120 lib.webnotes.app:application
directory=/path/to/erpnext
user=erpnext
process_name=%(program_name)s
autostart=True
autorestart=True
redirect_stderr=True
I have installed a Gitlab on a brand new Ubuntu (10.04) and it is working almost correctly. Gitlab is reachable on HTTP, I can push/pull data via git to the server. There is one thing missing though, the activity feed is not updating. So I thought there is something wrong with the git hooks. I completely followed the installation process from Gitlab except I'd like to use Passenger to run Nginx in order to deploy multiple apps.
I was running the the sudo -u gitlab -H bundle exec rake gitlab:env:info RAILS_ENV=production to see if everything is set up correctly, but it said, Redis is not running. ps aux says, redis-server is up. So it is not the git hooks. Gitlab docu says, restart the gitlab service to solve that problem. In this case I get an error which I think is the problem I need to solve:
$ sudo /etc/init.d/gitlab restart
Error, unicorn not running!
My question is, how can I get around this problem? How can I run unicorn, I thought the gitlab service would start it? Am I not using Nginx? Before I start reinstalling the whole thing firstly without using Passenger, I thought I might ask the question here beforehand.
As mentioned by the OP pabera, nginx and mysql must be started, for the other components of GitLab (redis, unicorn, and now sidekiq) to run properly.
The official /etc/init.d/gitlab is here.
I have my own version of gitlabd (here), because I manage sidekiq in my own script, and I don't need to run the script as root.
You can see the run order for all the services in this script:
ssh
Apache and/or NGiNX
mysql
redis
GitLab (which will start unicorn and sidekiq)
Kind of a poke in the dark...
In the GitLab installation.md README is states:
"
Start your GitLab instance:
sudo service gitlab start
# or
sudo /etc/init.d/gitlab restart
"
I did the first AND the second and got this exact error. However, I skipped the "or" and continued to the Nginx commands and it seems to work.
Hope this helps!
I issued a nginx -s stop and after that I got this error when trying to reload it.
[error]: invalid PID number "" in "/var/run/nginx.pid"
That /var/run/nginx/pid file is empty atm.
What do I need to do to fix it?
nginx -s reload is only used to tell a running nginx process to reload its config. After a stop, you don't have a running nginx process to send a signal to. Just run nginx (possibly with a -c /path/to/config/file)
in my case I solved this by starting the service.
sudo /etc/init.d/nginx start
The command above will start the service in Debian/Ubuntu. It will issue an error if there is any problem (like Apache listening in the same port)
After that nginx -s reload will work like a charm
This will clear out the issue on ubuntu 16.04 and above
sudo service nginx stop
you may need to remove the pid file nginx.pid whose location may be defined in file /etc/nginx/nginx.conf look for line like
cat /etc/nginx/nginx.conf | grep pid # see if pid file is defined
this line may live in file /etc/nginx/nginx.conf
pid /run/nginx.pid; # in file /etc/nginx/nginx.conf
if pid file does exist then remove it now
ls -la /var/run/nginx/pid # this file may live elsewhere
ls -la /run/nginx.pid # on Ubuntu 16.04+
after the pid file has been removed lets launch nginx
sudo service nginx start
ps -eaf|grep nginx # confirm its running
sudo nginx -t && sudo nginx -s reload # confirm config is OK
# typical output
# nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
# nginx: configuration file /etc/nginx/nginx.conf test is successful
sudo service nginx stop # issue stop
ps -eaf|grep nginx # confirm it actually stopped
now sanity has been restored and you are free to launch at will
In the latest version(1.2.0) that I downloaded there is no "-s start" option, it will say
nginx: invalid option: "-s start"
You can start nginx by
sudo /etc/nginx/sbin/nginx
The server will be started and then there wont be any Invalid pid number errors.
To avoid downtime with restarting nginx,
ps aux | grep nginx
PID of nginx master process
echo PID > /var/run/nginx.pid
nginx -s reload
In my case nginx was stopped (crashed I assume). Solved the issue by:
service nginx status
nginx stop/waiting
service nginx start
nginx start/running, process 3535
Then nginx -s reload worked like a charm.
I am using nginx/1.8.0 on trusty.
This happens if the nginx process was stopped manually or was killed.
Check if the process is still running:
sudo lsof -nP -iTCP:<port> | grep LISTEN
I am on mac, and I reinstall the nginx with:
brew reinstall nginx
Then start the service using brew:
brew services start nginx
On CentOS 7 I done it with this:
sudo systemctl start nginx
#Then check all things are OK
sudo systemctl status -l nginx
For anyone who still has issues, in my case, there was an apache2 server that was running.
You can try debugging what went wrong in your nginx machine by executing this command -
systemctl status nginx
This gave me an insight that the port was already in us by apache2 server.
so you can do sudo service apache2 stop and then do sudo service nginx start.
Docker Alpine users should use
nginx
by using that nginx will be start there is no error by
nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
then reload it by
nginx -s reload