0

/etc/nginx/conf.dに2つのconf(host1.com、host2.com)ファイルを取得しましたが、同じサイトへの2つのドメインアクセスを取得したWebサーバーでnginxを使用するvpsがあります。これらのサイトは異なるテクノロジー上にあり、1 つの PHP (88 で実行される Apache) と 1 つの python (5000 で実行される gunicorn) の両方のサイトは、これらのポートを使用して外部から正しくアクセスできます。

サイト 1 の設定

server{
    listen   80;

    root /var/www/host1.com/public;
    index index.php index.html index.htm;

    server_name host1.com;

    location / {
    try_files $uri $uri/ /index.php;
    }

    location ~ \.php$ {

    proxy_set_header X-Real-IP  $remote_addr;
    proxy_set_header X-Forwarded-For $remote_addr;
    proxy_set_header Host $host;
    proxy_pass http://127.0.0.1:88;

     }

     location ~ /\.ht {
            deny all;
     }
}

host2 conf

server {
    listen 80;
    server_name host2.com;
    access_log  /var/log/nginx/fundacion.log;

    location / {
        proxy_pass http://127.0.0.1:5000;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
    }
}

前もって感謝します。

4

1 に答える 1

1
  1. nginx を再起動します。
  2. ブラウザのキャッシュをクリアします。
于 2013-11-11T15:11:55.213 に答える