複数サイトを起動させる際の/etc/nginx/conf.d/local.conf 別にlocal.confの箇所は何でもいい $ sudo vi /etc/nginx/conf.d/local.conf ---------------------------------------------------------------------------------------------------------#myapp1 upstream myapp1 { server unix:/home/vagrant/railsapp/myapp1/tmp/sockets/unicorn.sock fail_timeout=0; }#myapp2 upstream myapp2 { server unix:/home/vagrant/railsapp/myapp2/tmp/sockets/unicorn.sock fail_timeout=0; } server { listen 80 default_server; server_name localhost; client_max_body_size 100m; error_page 404 /404.html; error_page 500 502 503 504 /500.html; location /myapp1 { root /home/vagrant/railsapp/myapp1; access_log /var/log/nginx/myapp1_access.log; error_log /var/log/nginx/myapp1_error.log; try_files $uri/index.html $uri @unicorn-app1; } location @unicorn-app1 { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_pass http://myapp1; } location /myapp2 { root /home/vagrant/railsapp/myapp2; access_log /var/log/nginx/myapp2_access.log; error_log /var/log/nginx/myapp2_error.log; try_files $uri/index.html $uri @unicorn-app2; } location @unicorn-app2 { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_pass http://myapp2; } }
複数サイトを起動させる際の/etc/nginx/conf.d/local.conf 別にlocal.confの箇所は何でもいい $ sudo vi /etc/nginx/conf.d/local.conf...
=======================================
http://ift.tt/1abnmbU
May 26, 2016 at 02:52PM
=======================================
複数サイトを起動させる際の/etc/nginx/conf.d/local.conf
別にlocal.confの箇所は何でもいい
$ sudo vi /etc/nginx/conf.d/local.conf
---------------------------------------------------------------------------------------------------------
#myapp1
upstream myapp1 {
server unix:/home/vagrant/railsapp/myapp1/tmp/sockets/unicorn.sock fail_timeout=0;
}
#myapp2
upstream myapp2 {
server unix:/home/vagrant/railsapp/myapp2/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80 default_server;
server_name localhost;
client_max_body_size 100m;
error_page 404 /404.html;
error_page 500 502 503 504 /500.html;
location /myapp1 {
root /home/vagrant/railsapp/myapp1;
access_log /var/log/nginx/myapp1_access.log;
error_log /var/log/nginx/myapp1_error.log;
try_files $uri/index.html $uri @unicorn-app1;
}
location @unicorn-app1 {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://myapp1;
}
location /myapp2 {
root /home/vagrant/railsapp/myapp2;
access_log /var/log/nginx/myapp2_access.log;
error_log /var/log/nginx/myapp2_error.log;
try_files $uri/index.html $uri @unicorn-app2;
}
location @unicorn-app2 {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://myapp2;
}
}
別にlocal.confの箇所は何でもいい
$ sudo vi /etc/nginx/conf.d/local.conf
---------------------------------------------------------------------------------------------------------
#myapp1
upstream myapp1 {
server unix:/home/vagrant/railsapp/myapp1/tmp/sockets/unicorn.sock fail_timeout=0;
}
#myapp2
upstream myapp2 {
server unix:/home/vagrant/railsapp/myapp2/tmp/sockets/unicorn.sock fail_timeout=0;
}
server {
listen 80 default_server;
server_name localhost;
client_max_body_size 100m;
error_page 404 /404.html;
error_page 500 502 503 504 /500.html;
location /myapp1 {
root /home/vagrant/railsapp/myapp1;
access_log /var/log/nginx/myapp1_access.log;
error_log /var/log/nginx/myapp1_error.log;
try_files $uri/index.html $uri @unicorn-app1;
}
location @unicorn-app1 {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://myapp1;
}
location /myapp2 {
root /home/vagrant/railsapp/myapp2;
access_log /var/log/nginx/myapp2_access.log;
error_log /var/log/nginx/myapp2_error.log;
try_files $uri/index.html $uri @unicorn-app2;
}
location @unicorn-app2 {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_pass http://myapp2;
}
}
http://ift.tt/1abnmbU
May 26, 2016 at 02:52PM
コメント
コメントを投稿