Skip to content

Instantly share code, notes, and snippets.

@goocey
Last active August 29, 2015 14:21
Show Gist options
  • Save goocey/75b8fcb89ff437036e82 to your computer and use it in GitHub Desktop.
Save goocey/75b8fcb89ff437036e82 to your computer and use it in GitHub Desktop.
[luna@localhost workbox]$ mkdir reverse_proxy
[luna@localhost workbox]$ cd reverse_proxy/
[luna@localhost reverse_proxy]$ mkdir centos7 centos6
[luna@localhost reverse_proxy]$ cd centos6/
[luna@localhost centos6]$ vagrant init centos6.64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
[luna@localhost centos7]$ vagrant init centos7.64
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
そして、各々のVagrantfileを以下の設定を有効にしてIPを各々に割り振る
config.vm.network "private_network", ip: "192.168.33.10" -- centos6
config.vm.network "private_network", ip: "192.168.33.11" -- centos7
んで、おのおのvagrant up
起動が終わったら、vagrant ssh
これも各々でやってね。
sudo gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
\curl -sSL https://get.rvm.io | bash
source ~/.profile
rvm list known
rvm install 2.2
gem install rails
vim Gemfile でexecjsでひつようなランタイムを定義
bundle install
rails create hoge
cd hoge
rails s
簡単ですね。しかも、これだけで複数バージョンのrubyの環境が整うというのだから、、、、うっ
server {
listen 80;
server_name rails1.tluna.mydns.jp;
access_log /var/log/nginx/test.rails.log main;
#この辺参考にした http://9ensan.com/blog/server/sakura-vps-nginx-reverse-proxy/
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
location / {
proxy_pass http://192.168.33.10:3000;
}
}
server {
listen 80;
server_name rails2.tluna.mydns.jp;
access_log /var/log/nginx/test.rails.log main;
#この辺参考にした http://9ensan.com/blog/server/sakura-vps-nginx-reverse-proxy/
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Real-IP $remote_addr;
location / {
proxy_pass http://192.168.33.11:3000;
}
}
これをconf.dとかにつくって読み込ませる。
やべー簡単だ。
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment