LoginSignup
1
1

More than 5 years have passed since last update.

ちょっと開発中のWebアプリを見てもらおう、って時にやること

Last updated at Posted at 2017-04-07

トライアルアップする前に、ちょっと同僚にWebアプリを見てもらいたい・・・
タブレット端末(実機)で動作確認したい・・・

昔ながらの、リバースプロキシ。

バージョン

$ docker -v
Docker version 1.8.3, ・・・
$ apachectl -v
Server version: Apache/2.4.18 (Unix)

1. Dockerでnginxを起動する

参考:https://hub.docker.com/_/nginx/

$ mkdir -p ~/some/content
$ vi ~/some/content/test.html
test!!!
$ docker run --name some-nginx -v ~/some/content:/usr/share/nginx/html:ro -d -p 8080:80 nginx

2. ブラウザから確認

$ docker-machine ls
NAME      ACTIVE   DRIVER       STATE     URL                         SWARM
default   *        virtualbox   Running   tcp://192.168.99.100:2376 

http://192.168.99.100:8080/test.html

3. LAN側のIPアドレスを確認

$ ifconfig en0
en0: flags=XXXX<UP,BROADCAST,SMART,RUNNING,SIMPLEX,MULTICAST> mtu 1500
    ether ・・・・
    inet6 ・・・・
    inet 192.168.1.10 netmask ・・・・
    nd6 ・・・・

192.168.1.10

4. apache2の設定

参考:http://qiita.com/gingi99/items/83c1fb07644cd232d91e

httpd.confに、リバースプロキシの設定を追加

$ sudo vi /etc/apache2/httpd.conf
LoadModule proxy_module libexec/apache2/mod_proxy.so
LoadModule proxy_http_module libexec/apache2/mod_proxy_http.so

ProxyRequests Off
ServerName 192.168.1.10
ProxyPass / http://192.168.99.100:8080/
ProxyPassReverse / http://192.168.99.100:8080/
$ sudo apachectl restart

5. タブレット端末から確認

タブレット端末を同一LANに接続

http://192.168.1.10/test.html
1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1