nginxでバーチャルホスト

ロシア製のWebサーバnginxを色々と設定中。

とりあえず備忘録


バーチャルホスト設定とプロクシの設定
既存のApacheを[port:8080]に設定して新規ドメインのみnginxが応答するようにする。

  • nginx.conf
    server {
        listen       www.mydomdesuyo.ne.jp;
        server_name  www.mydomdesuyo.ne.jp mydomdesuyo.ne.jp;
        access_log off;
        location / {
            proxy_pass http://localhost:8080;
        }
    }

    server {
        listen       mydomdesuyo.com;
        server_name  mydomdesuyo.com *.mydomdesuyo.com;
        location / {
            root   html;
            autoindex  on;
            index  index.html index.htm index.php;
        }
    }