Apache2 vHostの問題:サブドメインが正しく機能しない

Apache2 vHostの問題:サブドメインが正しく機能しない

まず、私はまだLinux/Apacheに初めて触れています。

私の問題:サブドメインforum.lumix-transporte.deを介して私のフォーラムにアクセスしようとしています。通常、lumix-transporte.de/forumからアクセスできます。

私のforum.confファイル:

<VirtualHost *:80>

        ServerName forum.lumix-transporte.de
        ServerAdmin [email protected]

        DocumentRoot /var/www/forum

        <Directory /var/www/forum>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
        </Directory>

</VirtualHost>

forum.lumix-transporte.deを使用してフォーラムにアクセスしようとすると、lumix-transporte.deにリダイレクトされるため、デフォルトのApache2ページ「動作します!」にリダイレクトされます。ソフトウェアアイコンもタブに表示されます。

/etc/apache2/sites-availableのデフォルトファイル:

<VirtualHost *:80>
        ServerAdmin webmaster@localhost

        DocumentRoot /var/www
        <Directory />
                Options FollowSymLinks
                AllowOverride None
        </Directory>
        <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride None
                Order allow,deny
                allow from all
        </Directory>

        ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
        <Directory "/usr/lib/cgi-bin">
                AllowOverride None
                Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
                Order allow,deny
                Allow from all
        </Directory>

        ErrorLog ${APACHE_LOG_DIR}/error.log

        # Possible values include: debug, info, notice, warn, error, crit,
        # alert, emerg.
        LogLevel warn

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

jacek.ciach 3で提案された2つのコマンドを実行した後:

root@lumix-transporte:/etc/apache2# grep -R Redirect *
root@lumix-transporte:/etc/apache2# grep -R lumix-transporte.de *
sites-available/default:        ServerName lumix-transporte.de
sites-available/forum.conf:     ServerName forum.lumix-transporte.de
sites-available/forum.conf:     ServerAdmin [email protected]
sites-enabled/forum.conf:       ServerName forum.lumix-transporte.de
sites-enabled/forum.conf:       ServerAdmin [email protected]
sites-enabled/000-default:      ServerName lumix-transporte.de

// wcfデータベースでphpmyadminを介してwcf1_applicationテーブルを変更し、ドメイン名のパスを/ forumから/に、ドメイン名をlumix-transporte.deからforum.lumix-transporte.deに変更して、ついに機能しました。フォーラム自体がこの問題を引き起こす可能性があると言ってくれたjacek.ciachに感謝します。私はより多くのインターネット検索でこれを見つけました。

ベストアンサー1

最初のソリューション

*.confまた、ファイルの処理順序を確認してください。

.conffor*.lumix-transporte.deの前に「run」があり、ある種forum.confのリダイレクトコマンドがあると、決してforum.conf処理されません。

したがって、順序を変更できます(たとえば、forum.confの名前をに変更するなど000-forum.conf)。または、私の考えでは、.confforが*.lumix-transporte.deクラッシュしないように修正forum.conf(競合する可能性があるワイルドカードとガイドラインを確認)の結果は次のとおりですServerNameServerAliasリダイレクト)。

2番目の解決策

defaultそうでないため、Apacheは以前に処理したServerNameときにクライアントに次のWebサイトを送信します。defaultforum.conf/var/www

ServerName lumix-transporte.de(で<VirtualHost>)Apacheを追加しdefaultて再起動します。

3番目のソリューション

フォーラム自体がリダイレクトを引き起こしているようです。 (http://forum.lumix-transporte.de/IEで応答ヘッダーを確認するhttp://web-sniffer.net/とわかります...)。

おすすめ記事