ubuntu - 通过 passenger-install-nginx-module 安装的 nginx 和直接安装的 nginx 有什么区别?
PHP中文网
PHP中文网 2017-04-22 08:55:48
0
2
803

系统中的 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吗?

PHP中文网
PHP中文网

认证0级讲师

全員に返信(2)
阿神
  1. 2 つの起動方法自体は、nginx の場合と大きな違いはありませんが、前者は起動にシステムの統合サービス スクリプトを使用する点が異なります。ただし、インストール方法に基づくと、両方が同じ nginx インストールを使用しているかどうかはわかりません。判断方法: /etc/init.d/nginx スクリプトの内容を確認し、22 行程度を見て、nginx のパス設定が何になっているか、2 番目に直接起動した nginx と同じパスかどうかを確認します。 NGINX_CONF_FILE パスが一貫しているかどうかも確認してください

  2. 理由はありません。サービスモードを使わずにnginxコマンドで直接操作することもできますが、前者の方が便利で統一管理ができます。 Linux はブート時に自動的に起動し、通常はサービス スクリプトを呼び出します。

  3. はい、ただし再コンパイルプロセスを実行する必要があります。ただし、以前にインストールした nginx のソース コードがどこにあるかを知っておく必要があります (自分でコンパイルしてインストールするのは簡単ですが、apt-get でインストールした場合、ソース コードが保持されるかどうかはわかりません)。ソース コードの場所はわかっています。「Nginx を自動的にダウンロードしてインストールしますか?」を抜粋すると、2. No: I want to customize my Nginx installation.,然后安装脚本会让你选择之前源代码位置,增加之前configure的参数(nginx -V を選択して表示されます)、もう一度プロンプトに従います。

1に基づいた判断に基づいて、2つのnginxの実際のパスが同じであれば、起動時にサービススクリプトを直接使用することをお勧めします。

いいねを押す +0
迷茫
  • Passenger-install-nginx-module を通じて、インストールされた nginx は元の nginx と競合しません。これは、別の nginx を別のディレクトリにインストールするのと同じです。

  • この違いの理由は、1 つはサービス起動スクリプトであり、もう 1 つは直接プログラムであるためです。

  • すでにnginxがインストールされているシステムは確実にpassengerをインストールできます

ドキュメントをもっと読んでください。そのような質問をする必要はありません。

いいねを押す +0
人気のチュートリアル
詳細>
最新のダウンロード
詳細>
ウェブエフェクト
公式サイト
サイト素材
フロントエンドテンプレート
私たちについて 免責事項 Sitemap
PHP中国語ウェブサイト:福祉オンライン PHP トレーニング,PHP 学習者の迅速な成長を支援します!