ip和域名的关系是一对多,为什么我用IP访问就报错,用域名就正确???

解决方案 »

  1.   

    你用的apache加tomcat?
    如果是apache没有配对,
    在apache里面,用192_168_1_1代替192.168.1.1
      

  2.   

    ibm http server 
    就是apache
      

  3.   

    没有上面说的IP啊
    只有server name a ?
    该怎么改?ServerName tanhr.
    # This is the main server configuration file. See URL http://www.apache.org/
    # for instructions.# Do NOT simply read the instructions in here without understanding
    # what they do, if you are unsure consult the online docs. You have been
    # warned.# Originally by Rob McCool# Note: Where filenames are specified, you must use forward slashes
    # instead of backslashes. e.g. "c:/apache" instead of "c:\apache". If
    # the drive letter is ommited, the drive where Apache.exe is located
    # will be assumed# this is a True Config File
    # see http://www.apache.org/info/three-config-files.html# ResourceConfig /dev/null
    # AccessConfig /dev/null# ServerType must be standalone.ServerType standalone# ServerRoot: The directory the server's config, error, and log files
    # are kept inServerRoot "d:/Program Files/IBM HTTP Server"
      

  4.   

    去掉注释后这个文件的内容是下面的,该怎么添加呢?ServerName tanhr.
    ServerType standalone
    ServerRoot "d:/Program Files/IBM HTTP Server"
    Port 80
    AfpaEnable
    AfpaCache on
    AfpaLogFile "d:/Program Files/IBM HTTP Server/logs/afpalog" V-ECLF
    HostnameLookups off
    ServerAdmin [email protected]
    ErrorLog logs/error.log
    LogLevel warn
    LogFormat "%h %l %u %t \"%r\" %>s %b \"%{Referer}i\" \"%{User-Agent}i\"" combined
    LogFormat "%h %l %u %t \"%r\" %>s %b" common
    LogFormat "%{Referer}i -> %U" referer
    LogFormat "%{User-agent}i" agent
    CustomLog logs/access.log common
    PidFile logs/httpd.pid
    ScoreBoardFile logs/apache_status
    #ServerName new.host.name
    UseCanonicalName on
    Timeout 300
    KeepAlive On
    MaxKeepAliveRequests 100
    KeepAliveTimeout 15
    MaxRequestsPerChild 0
    ThreadsPerChild 50
    <Directory "d:/Program Files/IBM HTTP Server/htdocs">
    Options Indexes
    AllowOverride None
    order allow,deny
    allow from all
    </Directory>
    <Directory "d:/Program Files/IBM HTTP Server/cgi-bin">
    AllowOverride None
    Options None
    </Directory>
    DocumentRoot "d:/Program Files/IBM HTTP Server/htdocs"
    DirectoryIndex index.html
    FancyIndexing on
    AddIconByEncoding (CMP,/icons/compressed.gif) x-compress x-gzip
    AddIconByType (TXT,/icons/text.gif) text/*
    AddIconByType (IMG,/icons/image2.gif) image/*
    AddIconByType (SND,/icons/sound2.gif) audio/*
    AddIconByType (VID,/icons/movie.gif) video/*
    AddIcon /icons/binary.gif .bin .exe
    AddIcon /icons/binhex.gif .hqx
    AddIcon /icons/tar.gif .tar
    AddIcon /icons/world2.gif .wrl .wrl.gz .vrml .vrm .iv
    AddIcon /icons/compressed.gif .Z .z .tgz .gz .zip
    AddIcon /icons/a.gif .ps .ai .eps
    AddIcon /icons/layout.gif .html .shtml .htm .pdf
    AddIcon /icons/text.gif .txt
    AddIcon /icons/c.gif .c
    AddIcon /icons/p.gif .pl .py
    AddIcon /icons/f.gif .for
    AddIcon /icons/dvi.gif .dvi
    AddIcon /icons/uuencoded.gif .uu
    AddIcon /icons/script.gif .conf .sh .shar .csh .ksh .tcl
    AddIcon /icons/tex.gif .tex
    AddIcon /icons/bomb.gif core
    AddIcon /icons/back.gif ..
    AddIcon /icons/hand.right.gif README
    AddIcon /icons/folder.gif ^^DIRECTORY^^
    AddIcon /icons/blank.gif ^^BLANKICON^^
    DefaultIcon /icons/unknown.gif
    ReadmeName README
    HeaderName HEADER
    IndexIgnore .??* *~ *# HEADER* README* RCS
    AccessFileName .htaccess
    <Files .htaccess>
    order allow,deny
    deny from all
    </Files>
    TypesConfig conf/mime.types
    DefaultType text/plain
    AddEncoding x-compress Z
    AddEncoding x-gzip gz
    AddLanguage en .en
    AddLanguage fr .fr
    AddLanguage de .de
    AddLanguage it .it
    AddLanguage ko .ko
    AddLanguage es .es
    AddLanguage ja .ja
    AddLanguage zh-CN .cn
    AddLanguage zh-TW .tw
    AddLanguage pt-BR .pt
    LanguagePriority en 
    Alias /icons/ "d:/Program Files/IBM HTTP Server/icons/"
    ScriptAlias /cgi-bin/ "d:/Program Files/IBM HTTP Server/cgi-bin/"
    BrowserMatch "Mozilla/2" nokeepalive
    BrowserMatch "MSIE 4\.0b2;" nokeepalive downgrade-1.0 force-response-1.0
    BrowserMatch "RealPlayer 4\.0" force-response-1.0
    BrowserMatch "Java/1\.0" force-response-1.0
    BrowserMatch "JDK/1\.0" force-response-1.0
    <files apadminred.html>
    ErrorDocument 404 /9ainterim.htm
    </files>
      

  5.   

    知道原因了:)呵呵不是这个造成的!!!!
    是我的js中用了location.hostname   
    而浏览器访问用户用的iphostname 包含URL中主机名的字符串.如http://www.csdn.net 
    大家知道location.hostname   对应的取ip的对象和属性是什么吗?