Nginx 通过 passenger-install-nginx-module 安装的 nginx 和直接安装的 nginx 有什么区别?

newbie · 2013年12月19日 · 最后由 liwei78 回复于 2013年12月19日 · 7135 次阅读

系统中的 nginx 是这样安装的

sudo apt-get install nginx

安装了 passenger 后

gem install passenger

还需安装 nginx module 才能在 nginx 中配置使用它。在安装时

passenger-install-nginx-module

提示

Automatically download and install Nginx?

Nginx doesn't support loadable modules such as some other web servers do,
so in order to install Nginx with Passenger support, it must be recompiled.

Do you want this installer to download, compile and install Nginx for you?

 1. Yes: download, compile and install Nginx for me. (recommended)
    The easiest way to get started. A stock Nginx 1.4.4 with Passenger
    support, but with no other additional third party modules, will be
    installed for you to a directory of your choice.

 2. No: I want to customize my Nginx installation. (for advanced users)
    Choose this if you want to compile Nginx with more third party modules
    besides Passenger, or if you need to pass additional options to Nginx's
    'configure' script. This installer will  1) ask you for the location of
    the Nginx source code,  2) run the 'configure' script according to your
    instructions, and  3) run 'make install'.

Whichever you choose, if you already have an existing Nginx configuration file,
then it will be preserved.

【问题 1】这样再次安装 nginx 的话,和原来的版本没有冲突吗?

直接安装的 nginx 的启动方法是

sudo service nginx start
sudo service nginx restart
sudo service nginx stop

通过 passenger-install-nginx-module 安装的 nginx 的启动方法是

sudo nginx
sudo nginx -s reload
sudo nginx -s stop

【问题 2】为什么会有这样的区别呢?

【问题 3】在已经存在 nginx 的系统中,有其它方式安装 passenger 的 nginx module 吗?

通过 passenger-install-nginx-module 安装的是完整编译安装版,目录会默认到/opt/nginx。 系统自带的,是精简版,目录在/etc/nginx 别用 passenger 了,用 puma 吧,跑得多顺畅。passenger 早期图省事可以玩玩,但是生产环境还是 puma 吧

找个测试机器,都玩玩,玩出经验在上 production

#3 楼 @newbie 忘记了,好久没玩环境了。http://railser.cn/blog/rails-on-centos-step-by-step/ 这个有点老,自己都忘了内容了,但是当时边玩边写,写了一周。

#4 楼 @liwei78 谢谢。从你的网站看到一些别的东西,不由得敬佩。

#5 楼 @newbie 客气客气,加油。

需要 登录 后方可回复, 如果你还没有账号请 注册新账号