BC Blog

Chase Excellence, Success will Follow

0%

Setup Nginx for Multiple Apps

If anyone wants to set up a few testing sites on only one IP server, we could modify the Nginx config file to open different port for servers deployment.

First, look for the config file

1
$ vi nginx/conf/nginx.conf

Then, take the below codes for sample.

nginx/conf/nginx.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
server {
listen 180;
server_name localhost;
root /home/ruling/orbit_1/public; # <--- be sure to point to 'public'!
passenger_enabled on;
rails_env production;

location /static/ {
root /home/ruling/orbit_1/public;
}

location ~ ^/(assets)/ {
root /home/ruling/orbit_1/public;
expires max;
add_header Cache-Control public;
}
}

server {
listen 280;
server_name localhost;
root /home/ruling/orbit_2/public; # <--- be sure to point to 'public'!
passenger_enabled on;
rails_env production;

location /static/ {
root /home/ruling/orbit_2/public;
}

location ~ ^/(assets)/ {
root /home/ruling/orbit_2/public;
expires max;
add_header Cache-Control public;
}
}

Welcome to my other publishing channels