2017-06-19 10 views
-2

Apache2サーバーをUbuntu 16.04 LTS Serverではじめて設定します。私はかなり満足していた1つのサイトを稼働させました。 /var/www/html/site2/etc/apache2/sites-available/001-default.confという名前.confファイルを作成し、次に: は、今私は、私は2番目のサイトのディレクトリを作成し初めてApacheを操作すると、2つのサイトを設定できないようです。

同じサーバー上に第二のサイトを作成し、internalIP/SITE1とinternalIP /サイト2を経由してアクセスしたいです

<VirtualHost *:80> 
    DocumentRoot "/var/www/html/site2/" 
    ServerName site2 
</VirtualHost> 

sudo a2ensite site2を有効にするために使用しました。

私SITE1の利用可能なサイト/中.confファイルが/etc/apache2/sites-available/000-default.confされており、次のようになります。今、(私には)奇妙なことは、私は、サーバー私の私の内部IPに行くたびということです

<VirtualHost *:80> 
     # The ServerName directive sets the request scheme, hostname and port that 
     # the server uses to identify itself. This is used when creating 
     # redirection URLs. In the context of virtual hosts, the ServerName 
     # specifies what hostname must appear in the request's Host: header to 
     # match this virtual host. For the default virtual host (this file) this 
     # value is not decisive as it is used as a last resort host regardless. 
     # However, you must set it for any further virtual host explicitly. 
     #ServerName www.example.com 

     ServerAdmin [email protected] 
     ServerName support 
     ServerAlias support 
     DocumentRoot /var/www/html/osticket/ 

     # Available loglevels: trace8, ..., trace1, debug, info, notice, warn, 
     # error, crit, alert, emerg. 
     # It is also possible to configure the loglevel for particular 
     # modules, e.g. 
     #LogLevel info ssl:warn 

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

     # For most configuration files from conf-available/, which are 
     # enabled or disabled at a global level, it is possible to 
     # include a line for only one particular virtual host. For example the 
     # following line enables the CGI configuration for this host only 
     # after it has been globally disabled with "a2disconf". 
     #Include conf-available/serve-cgi-bin.conf 
</VirtualHost> 

# vim: syntax=apache ts=4 sw=4 sts=4 sr noet 

すぐにSite1に着陸します。たぶん私はこれに関連するいくつかの設定を変更しましたが、私は思い出せません...前にアクセスするために私はInternalIP/osticket(site1の名前)に行かなければならないことを知っています。私は内部IP/site2またはそのようなものによってsite2にアクセスすることはできません。 404エラーが見つかりません。

これは私の初めてのことであり、十分な情報を覚えて提供するために最善を尽くしています。

答えて

1

今私がサーバーの内部IPに行くたびに、Site1に即座に着陸するということです。

これは正常です。既定のサイトは最初に定義されたサイトです。サーバーが知っているホスト名でサイトにアクセスしない場合は、最初に取得します。

私は/var/www/html/osticket/site2が存在しないためですinternalIP/SITE2

によってサイト2にアクセスするために管理することはできません。


あなたはあなたがホスティング仮想名を使用しているhttp://site2/の代わりhttp://192.168.1.123/site2/

にアクセスする必要があります。名前を使用する必要があります。

(例のためにIPアドレスを作成しました)

+0

ありがとう、私はあなたの話を理解しています。しかし今、私はsupport.internに行くことでsite1にアクセスできますが、site2.internに行くことでsite2にアクセスすることはできません。ここで何かが恋しい? –

+0

@ JaneMorning - あなたは 'ServerName site2.intern'ではなく' ServerName site2'と言っています。 – Quentin

+0

申し訳ありません、それは両方で動作しません。ここでは.internを使用していますが(ルータではそのように設定されています)、site2.internとsite2はどちらも動作しません。 –

関連する問題