LoginSignup
5
8

More than 5 years have passed since last update.

nginxでリバースプロキシ

Last updated at Posted at 2015-05-08

ssdpサーバーとhttpサーバーを共存させてUPnPを実現させたいというとき、なぜかdescriptionなどを取るためのGETメソッドは8080に対してなのに、操作系のPOST命令は80に対してしてくるコントローラーがあったので、それを捌くためにnginxでリバースプロキシしてみた。

/usr/local/etc/nginx/nginx.conf
        #listen       8080;
        #for reverse proxy
        listen       80;
        server_name  localhost;

        #charset koi8-r;

        #access_log  logs/host.access.log  main;

        location / {
            root   html;
            index  index.html index.htm;
            #for reverse proxy
            proxy_pass   http://127.0.0.1:8080;
        }

大事なのは、for reverse proxyの部分。これで8080へのリクエストには自前のサーバーへ、80へのリクエストでもnginxを通して8080へリダイレクトされる。

5
8
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
5
8