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

系统中的 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级讲师

reply all(2)
阿神
  1. The two startup methods themselves are not much different for nginx, except that the former uses the system's unified service script to start. But based on your installation method, I'm not sure whether both are using the same nginx installation. Judgment method: Check the content of the /etc/init.d/nginx script, look at about 22 lines, and see what the nginx path setting is, and whether it is the same path as your second directly started nginx. Also check if the NGINX_CONF_FILE path is consistent

  2. No reason. You can operate directly with nginx command without using service mode, but the former is more convenient and more unified in management. Linux automatically starts at boot and usually calls the service script.

  3. Yes, but you still have to go through the recompilation process. But you need to know where the source code of the previous installation of nginx is (it’s easy to compile and install it yourself; if you install it with apt-get, I don’t know if the source code will be retained). If you know the source code location, it is above you. When excerpting "Automatically download and install Nginx?", select 2. No: I want to customize my Nginx installation.,然后安装脚本会让你选择之前源代码位置,增加之前configure的参数(nginx -V to see it) and follow the prompts again.

Based on your judgment based on 1, if the actual paths of the two nginx are the same, it doesn’t matter. It is recommended to use the service script directly when starting.

迷茫
  • Through passenger-install-nginx-module, the nginx installed has no conflict with the original one. It is equivalent to installing another nginx in another directory.

  • The reason for this difference is that one is a service startup script and the other is directly a program.

  • Systems that have already installed nginx can definitely install passenger

Read the documentation more, there is no need to ask such questions.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!