2016-05-05 1 views
1

私は1つのVPSから複数のウェブサイトを提供するためにVarnishとApacheを設定しようとしています。しかし、ブラウザにseconddomain.nlと入力すると、デフォルトのapache2開始ページ(URLはVPSのIPアドレス)にリダイレクトされます。しかし、firstdomain.nlはうまく動作します。複数のApache仮想ホストを使用してvarnish 4.1.2を設定するにはどうすればよいですか?

etc/default/varnish

DAEMON_OPTS="-a :80 \ 
      -T localhost:1234 \ 
      -f /etc/varnish/default.vcl \ 
      -S /etc/varnish/secret \ 
      -s malloc,256m" 

(一部省略)

/etc/varnish/default.vcl

backend default { 
    .host = "127.0.0.1"; 
    .port = "8080"; 
} 

/etc/apache2/ports.conf

NameVirtualHost *:8080 
Listen 127.0.0.1:8080 

<IfModule ssl_module> 
     Listen 443 
</IfModule> 

<IfModule mod_gnutls.c> 
     Listen 443 
</IfModule> 
私のセットアップはこれです

/etc/apache2/sites-available/000-default.conf

<VirtualHost *:8080> 
     ServerName 188.166.71.35 

     ServerAdmin [email protected] 
     DocumentRoot /var/www/html 

     <Directory /var/www/jws/> 
      AllowOverride All 
     </Directory> 

     ErrorLog ${APACHE_LOG_DIR}/error.log 
     CustomLog ${APACHE_LOG_DIR}/access.log combined 
</VirtualHost> 

/etc/apache2/sites-available/seconddomain.nl.conf

<VirtualHost *:8080> 

     ServerAdmin [email protected] 
     ServerName seconddomain.nl 
     ServerAlias www.seconddomain.nl 
     DocumentRoot /var/www/jws 

     php_admin_value sendmail_path "/usr/sbin/sendmail -t -i [email protected] 
     ErrorLog ${APACHE_LOG_DIR}/error-seconddomain.log 
     CustomLog ${APACHE_LOG_DIR}/access-seconddomain.log combined 
</VirtualHost> 

/etc/apache2/sites-available/firstdomain.nl.conf

<VirtualHost *:8080> 

     ServerAdmin [email protected] 
     ServerName firstdomain.nl 
     ServerAlias www.firstdomain.nl 
     DocumentRoot /var/www/firstdomain.nl 

     php_admin_value sendmail_path "/usr/sbin/sendmail -t -i [email protected]$ 
     ErrorLog ${APACHE_LOG_DIR}/error-firstdomain.log 
     CustomLog ${APACHE_LOG_DIR}/access-firstdomain.log combined 
RewriteEngine on 
RewriteCond %{SERVER_NAME} =firstdomain.nl [OR] 
RewriteCond %{SERVER_NAME} =www.firstdomain.nl 
RewriteRule^https://%{SERVER_NAME}%{REQUEST_URI} [END,QSA,R=permanent] 
</VirtualHost> 
+1

ワニスなしで動作しますか? (両方のドメイン名で8080にサーフィンしている場合) – Jensd

+0

@ Jensdがカールしていてローカルマシンのブラウザで次のように表示されます。seconddomain.nlポート8080への接続に失敗しました:操作がタイムアウトしました。最初のドメインと同じです。 VPSでは接続が拒否されます(両方に対して)。 – Flobin

+0

あなたの問題は、Apacheやサーバー自体にあります - ワニスではありません!ファイアウォールを実行している – Jensd

答えて

0

私はあなたと同じ構成を持っていた、とそれを解決すると、/ etcにある127.0.0.1を削除しました/apache2/ports.conf

私は今どうしているのですか(変更された行についてコメントしました):

# If you just change the port or add more ports here, you will likely also 
# have to change the VirtualHost statement in 
# /etc/apache2/sites-enabled/000-default.conf 

#Listen 127.0.0.1:8080 
Listen 8080 

<IfModule ssl_module> 
     Listen 443 
</IfModule> 

<IfModule mod_gnutls.c> 
     Listen 443 
</IfModule> 
関連する問題