How to restart Phusion Passenger + Apache in Produ

2019-04-09 12:16发布

I am having Apache + phusion passenger, I have put

RailsEnv production

in /etc/apache2/sites-available/default file and have restarted apache but when I am running

rails c
> Rails.env.production?

it gives fales where as for

> Rails.env.development?

it gives true. Is there any other way to restart passenger as I do think putting "RailsEnv production" in default is the right way ? btw I am using

sudo service apache2 restart

How to start my ruby on rails app in Production mode with passenger + apache ?

4条回答
女痞
2楼-- · 2019-04-09 12:29

I followed the commands listed in PhusionPassenger docs here and they worked straight-away.

deployer@staging:~$ passenger-config restart-app
Please select the application to restart.
Tip: re-run this command with --help to learn how to automate it.
If the menu doesn't display correctly, press '!'

 ‣   /home/deployer/myapp/current (staging)
     /home/deployer/myapp_2/current (staging)
     Cancel

Restarting /home/deployer/myapp/current (staging)

deployer@staging:~$ passenger-config restart-app
Please select the application to restart.
Tip: re-run this command with --help to learn how to automate it.
If the menu doesn't display correctly, press '!'

     /home/deployer/myapp/current (staging)
 ‣   /home/deployer/myapp_2/current (staging)
     Cancel

Restarting /home/deployer/myapp_2/current (staging)
查看更多
Summer. ? 凉城
3楼-- · 2019-04-09 12:36

Your app is probably in production mode already.

By default, rails c loads the app in dvelopment mode.

If you want your console to be launched in production mode, do the following :

RAILS_ENV=production rails c

The console and the web app are two different rails proccess and run independently.

You should check your production.log file to be sure that your app runs in production.

查看更多
放我归山
4楼-- · 2019-04-09 12:45

Just for starting app with particular port use below command:

passenger start -a 0.0.0.0 -p 3000 -d -e production

查看更多
ら.Afraid
5楼-- · 2019-04-09 12:53

just create a restart.txt in tmp dir of your app

e.g.

  touch %RAILS_ROOT%/tmp/restart.txt

look here http://www.modrails.com/documentation/Users%20guide%20Apache.html section 3.3

查看更多
登录 后发表回答