When installing nginx under linux, it is generally required to set the installation path by prefix in the ./configure stage. Therefore, you can install multiple nginx by specifying different prefixes in ./configure.
It is worth noting that after installation, the listening ports of the two nginx should be set to different listening ports. Otherwise, there will be an nginx that fails to start.
1
2
|
./configure --prefix=/home/work/nginx1 .....
//第一个nginx的安装配置
make && make install
|
1
2
|
./configure --prefix=/home/work/nginx2 .....
//第二个nginx的安装配置
make && make install
|
1
2
|
cd /home/work/nginx1/conf/nginx.conf && 修改第一个nginx的监听端口.
./home/work/nginx1/sbin/nginx
|
1
2
|
cd /home/work/nginx2/conf/nginx.conf && 修改第二个nginx的监听端口.
./home/work/nginx2/sbin/nginx
|