Nginx in the system is installed as follows
sudo apt-get install nginx
After passenger is installed
gem install passenger
Nginx module needs to be installed before it can be configured for use in nginx. At the time of installation
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.
[Question 1] If nginx is installed again like this, is there no conflict with the original version?
The starting method of nginx installed directly is
sudo service nginx start sudo service nginx restart sudo service nginx stop
passenger-install-nginx-moduleThe starting method of installed nginx is
sudo nginx sudo nginx -s reload sudo nginx -s stop
[Question 2] Why is there such a difference?
[Question 3] Is there any other way to install passenger’s nginx module in a system where NGINX already exists?
The two startup methods are not very different from each other for nginx, but the former is started by using a unified service script of the system. However, based on your installation method, I am not sure whether the two are using the same nginx installation. Judging method: check the contents of the script /etc/init.d/nginx, and see about 22 lines, and see what the nginx path setting is, and whether it is a path with your second type of direct startup nginx. Also see if the NGINX_CONF_FILE path is consistent
No why. You can directly operate nginx command without using service mode, but the former is more convenient and more unified in management. Linux automatic startup also calls service scripts.
Yes, but it must go through the recompile process. However, you need to know where the source code for the previous installation of nginx was (compile and install it yourself. If you install with apt-get, I don’t know if I will keep the source code). if you know the location of the source code, the “automatically download and install nginx” excerpted above you. When choosing
2. No: I want to customize my Nginx installation., and then the installation script will let you select the previous source code location, add the previous configure parameter (
nginx -VCan see), according to the prompt again.
According to your judgment of 1, it doesn’t matter if the actual paths of the two nginx are the same. It is recommended to use the service script directly when starting.