一切工作正常,直到我發現了一個錯誤, 我的服務器無法訪問他自己的服務在127.0.0.1。 我不確定是否相關,但是當我在Internet Explorer中鍵入127.0.0.1時,它會等待,然後說www.127.0.0.1無法訪問。我添加了「www」。最近被迫,但現在我把這個腳本改爲'xxx'。而不是'www。'它仍然會將我重定向到www.127.0.0.1,我的其他網站會重定向到'xxx'。Apache工作正常,除了127.0.0.1
這是httpd.conf文件:
# 'Main' server configuration
#
# The directives in this section set up the values used by the 'main'
# server, which responds to any requests that aren't handled by a
# <VirtualHost> definition. These values also provide defaults for
# any <VirtualHost> containers you may define later in the file.
#
# All of these directives may appear inside <VirtualHost> containers,
# in which case these default settings will be overridden for the
# virtual host being defined.
#
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed. This address appears on some server-generated pages, such
# as error documents. e.g. [email protected]
#
ServerAdmin [email protected]
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
#ServerName www.example.net
ServerName 127.0.0.1
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
#DocumentRoot "c:/htdocs"
DocumentRoot "c:/htdocs"
#
# Each directory to which Apache has access can be configured with respect
# to which services and features are allowed and/or disabled in that
# directory (and its subdirectories).
#
# First, we configure the "default" to be a very restrictive set of
# features.
#
<Directory />
Options FollowSymLinks
AllowOverride none
Order deny,allow
Deny from all
</Directory>
#
# Note that from this point forward you must specifically allow
# particular features to be enabled - so if something's not working as
# you might expect, make sure that you have specifically enabled it
# below.
#
#
# This should be changed to whatever you set DocumentRoot to.
#
<Directory "c:/htdocs">
#
# Possible values for the Options directive are "None", "All",
# or any combination of:
# Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews
#
# Note that "MultiViews" must be named *explicitly* --- "Options All"
# doesn't give it to you.
#
# The Options directive is both complicated and important. Please see
# http://httpd.apache.org/docs/2.2/mod/core.html#options
# for more information.
#
Options Indexes FollowSymLinks
#
# AllowOverride controls what directives may be placed in .htaccess files.
# It can be "All", "None", or any combination of the keywords:
# Options FileInfo AuthConfig Limit
#
AllowOverride All
#
# Controls who can get stuff from this server.
#
Order allow,deny
Allow from all
</Directory>
這是的httpd-vhost.conf:
<VirtualHost 127.0.0.1:80>
DocumentRoot c:/htdocs
ServerName 127.0.0.1
ServerAlias www.127.0.0.1 localhost www.localhost
ErrorLog logs/example-intern-error.txt
CustomLog logs/example-intern-access.txt common
</VirtualHost>
<VirtualHost *:80>
DocumentRoot c:/htdocs
ServerName sa-arp.net
ServerAlias www.example.net www.example.com example.com
ErrorLog logs/example-error.txt
CustomLog logs/example-access.txt common
RewriteEngine On
RewriteCond %{HTTP_HOST} !^xxx\. [NC]
RewriteRule ^(.*)$ http://xxx.%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
</VirtualHost>
我嘗試了所有可能的組合,似乎沒有任何工作。
請幫我我資源和病人!
謝謝
RT-2
請將您的[mcve]發佈在問題本身,而不是鏈接到其他網站上的內容。 –