如何实现同一IP不同端口打开不同网页

由 netfun2000 在 01-27-2004 19:01 发表:

如何实现同一IP不同端口打开不同网页

例如

http://192.168.0.1:80 打开一个

http://192.168.0.1:81 打开另一个

是不是要修改那个httpd.conf?

谢谢指教。


由 wangguoqin1001 在 01-27-2004 19:39 发表:


在httpd.conf中有

Listen 12.34.56.78:80

Port 80

NameVirtualHost 12.34.56.78:80

把这几行修改成为相应端口就可以了。


欢迎访问: http://dev.8866.org

欢迎来信: [email protected]

为什么不能删除自己的帖子?


由 netfun2000 在 01-27-2004 20:12 发表:


> quote: > > * * * > > 最初由 wangguoqin1001 发表
>
> **在httpd.conf中有
>
> Listen 12.34.56.78:80
>
> Port 80
>
> NameVirtualHost 12.34.56.78:80
>
> 把这几行修改成为相应端口就可以了。 ** > > * * *

您的意思是:

NameVirtualHost 192.168.0.1

1<virtualhost 192.168.0.12="">   
2  
3ServerName cn.gn.com   
4  
5DocumentRoot /var/test   
6  
7</virtualhost>

能不能说详细一点,另外我的HTML文件如何定义放置的位置?

谢谢。


由 netfun2000 在 01-27-2004 20:17 发表:


我的意思是,我里面原来已经跑着一个端口81,我在IE中输入 http://192.168.0.1:81会出现主页A,

我现在想再添加一个端口80

让他在输入 http://192.168.0.1后出现主页B。

谢谢。


由 netfun2000 在 01-27-2004 20:23 发表:


httpd.conf -- Apache HTTP server configuration file

$Id: httpd.conf,v 1.3.2.4 2003/03/11 07:54:48 riddles Exp $

ServerType standalone

ServerRoot /etc/httpd

LoadModule env_module modules/mod_env.so

LoadModule config_log_module modules/mod_log_config.so

LoadModule referer_log_module modules/mod_log_referer.so

LoadModule mime_module modules/mod_mime.so

LoadModule autoindex_module modules/mod_autoindex.so

LoadModule dir_module modules/mod_dir.so

LoadModule cgi_module modules/mod_cgi.so

LoadModule alias_module modules/mod_alias.so

LoadModule access_module modules/mod_access.so

LoadModule auth_module modules/mod_auth.so

LoadModule setenvif_module modules/mod_setenvif.so

LoadModule ssl_module modules/libssl.so

LockFile /var/lock/httpd.lock

PidFile /var/run/httpd.pid

ScoreBoardFile /var/run/httpd.scoreboard

Timeout 300

KeepAlive On

MaxKeepAliveRequests 100

KeepAliveTimeout 15

MinSpareServers 2

MaxSpareServers 6

StartServers 4

MaxClients 30

MaxRequestsPerChild 100

Port 81

1<ifdefine ssl="">   
2  
3Listen 81   
4  
5Listen 445   
6  
7</ifdefine>

User nobody

Group nobody

ServerAdmin root@localhost

DocumentRoot /home/httpd/html

1<directory></directory>

Options None

AllowOverride None

 1<directory home="" html="" httpd="">   
 2  
 3Options ExecCGI   
 4  
 5AllowOverride None   
 6  
 7Order allow,deny   
 8  
 9Allow from all   
10  
11</directory>
 1<directorymatch "="" (mrtg|sgraph)"="" home="" html="" httpd="">   
 2  
 3AuthName "Restricted"   
 4  
 5AuthType Basic   
 6  
 7AuthUserFile /var/ipcop/auth/users   
 8  
 9require user admin   
10  
11</directorymatch>

ScriptAlias /cgi-bin/ /home/httpd/cgi-bin/

 1<directory cgi-bin="" home="" httpd="">   
 2  
 3AllowOverride None   
 4  
 5Options None   
 6  
 7AuthName "Restricted"   
 8  
 9AuthType Basic   
10  
11AuthUserFile /var/ipcop/auth/users   
12  
13Require user admin   
14  
15<files index.cgi="">   
16  
17Satisfy Any   
18  
19Allow from All   
20  
21</files>
22<files dial.cgi="">   
23  
24Require user admin dial   
25  
26</files>
27</directory>
1<ifmodule mod_dir.c="">   
2  
3DirectoryIndex index.html index.htm index.shtml index.cgi   
4  
5</ifmodule>

AccessFileName .htaccess

1<files "^\\.ht"="" ~="">   
2  
3Order allow,deny   
4  
5Deny from all   
6  
7</files>
1<ifmodule mod_mime.c="">   
2  
3TypesConfig /etc/mime.types   
4  
5</ifmodule>

DefaultType text/plain

1<ifmodule mod_mime_magic.c="">   
2  
3MIMEMagicFile share/magic   
4  
5</ifmodule>

HostnameLookups Off

ErrorLog /var/log/httpd/error_log

LogLevel warn

LogFormat "%h %l %u %t "%r" %>s %b" common

CustomLog /var/log/httpd/access_log common

ServerSignature On

 1<ifmodule mod_mime.c="">   
 2  
 3AddEncoding x-compress Z   
 4  
 5AddEncoding x-gzip gz tgz   
 6  
 7AddLanguage da .dk   
 8  
 9AddLanguage nl .nl   
10  
11AddLanguage en .en   
12  
13AddLanguage et .ee   
14  
15AddLanguage fr .fr   
16  
17AddLanguage de .de   
18  
19AddLanguage el .el   
20  
21AddLanguage he .he   
22  
23AddCharset ISO-8859-8 .iso8859-8   
24  
25AddLanguage it .it   
26  
27AddLanguage ja .ja   
28  
29AddCharset ISO-2022-JP .jis   
30  
31AddLanguage kr .kr   
32  
33AddCharset ISO-2022-KR .iso-kr   
34  
35AddLanguage no .no   
36  
37AddLanguage pl .po   
38  
39AddCharset ISO-8859-2 .iso-pl   
40  
41AddLanguage pt .pt   
42  
43AddLanguage pt-br .pt-br   
44  
45AddLanguage ltz .lu   
46  
47AddLanguage ca .ca   
48  
49AddLanguage es .es   
50  
51AddLanguage sv .se   
52  
53AddLanguage cz .cz   
54  
55AddLanguage ru .ru   
56  
57AddLanguage zh-tw .tw   
58  
59AddLanguage tw .tw   
60  
61AddCharset Big5 .Big5 .big5   
62  
63AddCharset WINDOWS-1251 .cp-1251   
64  
65AddCharset CP866 .cp866   
66  
67AddCharset ISO-8859-5 .iso-ru   
68  
69AddCharset KOI8-R .koi8-r   
70  
71AddCharset UCS-2 .ucs2   
72  
73AddCharset UCS-4 .ucs4   
74  
75AddCharset UTF-8 .utf8   
76  
77<ifmodule mod_negotiation.c="">   
78  
79LanguagePriority en da nl et fr de el it ja kr no pl pt pt-br ru ltz ca es sv tw   
80  
81</ifmodule>   
82  
83AddType application/x-tar .tgz   
84  
85AddHandler cgi-script .cgi   
86  
87AddType text/html .shtml   
88  
89AddHandler server-parsed .shtml   
90  
91AddHandler imap-file map   
92  
93</ifmodule>
 1<ifmodule mod_setenvif.c="">   
 2  
 3BrowserMatch "Mozilla/2" nokeepalive   
 4  
 5BrowserMatch "MSIE 4\\.0b2;" nokeepalive downgrade-1.0 force-response-1.0   
 6  
 7BrowserMatch "RealPlayer 4\\.0" force-response-1.0   
 8  
 9BrowserMatch "Java/1\\.0" force-response-1.0   
10  
11BrowserMatch "JDK/1\\.0" force-response-1.0   
12  
13</ifmodule>
1<ifdefine ssl="">   
2  
3AddType application/x-x509-ca-cert .crt   
4  
5AddType application/x-pkcs7-crl .crl   
6  
7</ifdefine>
 1<ifmodule mod_ssl.c="">   
 2  
 3SSLPassPhraseDialog builtin   
 4  
 5SSLSessionCache dbm:/var/log/httpd/ssl_scache   
 6  
 7SSLSessionCacheTimeout 300   
 8  
 9SSLMutex file:/var/log/httpd/ssl_mutex   
10  
11SSLRandomSeed startup builtin   
12  
13SSLRandomSeed connect builtin   
14  
15SSLLog /var/log/httpd/ssl_engine_log   
16  
17SSLLogLevel info   
18  
19</ifmodule>
 1<ifdefine ssl="">
 2<virtualhost _default_:445="">   
 3  
 4DocumentRoot /home/httpd/html   
 5  
 6ServerAdmin root@localhost   
 7  
 8ErrorLog /var/log/httpd/error_log   
 9  
10TransferLog /var/log/httpd/access_log   
11  
12SSLEngine on   
13  
14SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL   
15  
16SSLCertificateFile /etc/httpd/server.crt   
17  
18SSLCertificateKeyFile /etc/httpd/server.key   
19  
20<files "\\.(cgi|shtml?)$"="" ~="">   
21  
22SSLOptions +StdEnvVars   
23  
24</files>
25<directory cgi-bin="" home="" httpd="">   
26  
27SSLOptions +StdEnvVars   
28  
29</directory>   
30  
31SetEnvIf User-Agent ".*MSIE.*" \   
32  
33nokeepalive ssl-unclean-shutdown \   
34  
35downgrade-1.0 force-response-1.0   
36  
37CustomLog /var/log/httpd/ssl_request_log \   
38  
39"%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"   
40  
41</virtualhost>
42</ifdefine>

include /etc/httpd/conf/hostname.conf


由 wangguoqin1001 在 01-27-2004 20:23 发表:


原来是这样……没理解清楚。

我估计你写两个Listen,然后在VirtualHost里面分开来写就可以了。没试过。

你这apache,该是2.0的吧?咱还用着1.3.26呢。


欢迎访问: http://dev.8866.org

欢迎来信: [email protected]

为什么不能删除自己的帖子?


由 netfun2000 在 01-28-2004 07:36 发表:


不会没人搞过吧。


由 pangdae 在 01-28-2004 13:34 发表:


装两个apache

分别监听80,81端口,就可以了


MSN:[email protected]

QQ:120044083

Email:[email protected]


由 Glue 在 01-28-2004 14:51 发表:


> quote: > > * * * > > 最初由 pangdae 发表
>
> **装两个apache
>
> 分别监听80,81端口,就可以了 ** > > * * *

装只要装一个。

要做两个配置文件,就可以了。

是个办法。


-_-


由 netfun2000 在 01-28-2004 17:39 发表:


> quote: > > * * * > > 最初由 Glue 发表
>
> **装只要装一个。
>
> 要做两个配置文件,就可以了。
>
> 是个办法。 ** > > * * *

老大,能不能具体指教一二,我是刚入门的。

或从哪里能够找到相关

Published At
Categories with 服务器类
Tagged with
comments powered by Disqus