LinuxSir.cn,穿越时空的Linuxsir!

 找回密码
 注册
搜索
热搜: shell linux mysql
12
返回列表 发新帖
楼主: netfun2000

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

[复制链接]
 楼主| 发表于 2004-1-29 18:29:19 | 显示全部楼层
 楼主| 发表于 2004-1-29 18:30:31 | 显示全部楼层
最初由 netfun2000 发表
##
## 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

Timeout 300
KeepAlive On
MaxKeepAliveRequests 100
KeepAliveTimeout 15
MinSpareServers 2
MaxSpareServers 6
StartServers 4
MaxClients 30
MaxRequestsPerChild 100
Port 81

<VirtualHost _default_:445>
    DocumentRoot /home/httpd/html
    ServerAdmin root@localhost
    ErrorLog /var/log/httpd/error_log
    TransferLog /var/log/httpd/access_log
    SSLEngine on
    SSLCipherSuite ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv2:+EXP:+eNULL
    SSLCertificateFile /etc/httpd/server.crt
    SSLCertificateKeyFile /etc/httpd/server.key
    <Files ~ "\.(cgi|shtml?)$">
        SSLOptions +StdEnvVars
    </Files>
    <Directory /home/httpd/cgi-bin>
        SSLOptions +StdEnvVars
    </Directory>
    SetEnvIf User-Agent ".*MSIE.*" \
        nokeepalive ssl-unclean-shutdown \
        downgrade-1.0 force-response-1.0
    CustomLog /var/log/httpd/ssl_request_log \
        "%t %h %{SSL_PROTOCOL}x %{SSL_CIPHER}x \"%r\" %b"
</VirtualHost>

</IfDefine>

include /etc/httpd/conf/hostname.conf
发表于 2004-1-30 12:54:59 | 显示全部楼层
建立虚拟主机。
<VirtualHost *:445>
发表于 2004-1-30 13:37:31 | 显示全部楼层
端口转发81->08
哈哈
 楼主| 发表于 2004-1-30 16:09:59 | 显示全部楼层
我现在是这样做的:
在 Port 81 后添加了:
Port 80
并添加如下代码:
<IfDefine WWW>
  Listen 80
</IfDefine>

<IfDefine WWW>

<VirtualHost _default_:80>
  ServerRoot  /var/log/wwwroot
  DocumentRoot /var/log/wwwroot/html
  ServerAdmin netfun2000@tom.com

  ErrorLog /var/log/wwwroot/error_log
  Transferlog /var/log/wwwroot/access_log

  <Directory />
     Options None
     AllowOverride None
  </Directory>
  <Directory /var/log/wwwroot/html>
     Options ExecCGI
     AllowOverride None
     Ord allow,all
  </Directory>

</VirtualHost>
</IfDefine>

现在的问题是我输入http://192.168.0.1
出现的主页和输入
http://192.168.0.1:81
出现的都是同一个网页。我想让他出现不同的主页。请问我应该如何修改


谢谢。
 楼主| 发表于 2004-1-31 12:23:49 | 显示全部楼层
发表于 2004-1-31 14:09:08 | 显示全部楼层
最初由 netfun2000 发表
我现在是这样做的:
在 Port 81 后添加了:
Port 80
并添加如下代码:
<IfDefine WWW>
  Listen 80
</IfDefine>

<IfDefine WWW>

<VirtualHost _default_:80>
  ServerRoot  /var/log/wwwroot
  DocumentRoot /var/log/wwwroot/html
  ServerAdmin netfun2000@tom.com

  ErrorLog /var/log/wwwroot/error_log
  Transferlog /var/log/wwwroot/access_log

  <Directory />
     Options None
     AllowOverride None
  </Directory>
  <Directory /var/log/wwwroot/html>
     Options ExecCGI
     AllowOverride None
     Ord allow,all
  </Directory>

</VirtualHost>
</IfDefine>

现在的问题是我输入http://192.168.0.1
出现的主页和输入
http://192.168.0.1:81
出现的都是同一个网页。我想让他出现不同的主页。请问我应该如何修改


谢谢。



:rolleyes:
我晕~
你把不同的虚拟主机指向不同的文件夹啊。。。
你现在两个主机都是用同一个文件当然出现的内容是一模一样了。
当然啦。不同的文件夹里面也要放上不同的文件内容。
不然你又要说出现的都是同一个网页啦。。。。
 楼主| 发表于 2004-1-31 14:23:40 | 显示全部楼层
最初由 buick2u 发表
:rolleyes:
我晕~
你把不同的虚拟主机指向不同的文件夹啊。。。
你现在两个主机都是用同一个文件当然出现的内容是一模一样了。
当然啦。不同的文件夹里面也要放上不同的文件内容。
不然你又要说出现的都是同一个网页啦。。。。


当然了,请看:
ServerType standalone
ServerRoot /etc/httpd

81:
<IfDefine SSL>
Listen 81
Listen 445
</IfDefine>
User nobody
Group nobody
ServerAdmin root@localhost
DocumentRoot /home/httpd/html
<Directory />
Options None
AllowOverride None
</Directory>
<Directory /home/httpd/html>
Options ExecCGI
AllowOverride None
Order allow,deny
Allow from all
</Directory>

80:
<VirtualHost _default_:80>
ServerRoot /var/log/wwwroot
DocumentRoot /var/log/wwwroot/html
ServerAdmin netfun2000@tom.com

ErrorLog /var/log/wwwroot/error_log
Transferlog /var/log/wwwroot/access_log
 楼主| 发表于 2004-2-1 09:50:51 | 显示全部楼层
发表于 2004-2-1 12:48:03 | 显示全部楼层
对了,你一旦启用了虚拟主机上面的设置就不起作用了。

你只能在下面添加一个 80 端口的虚拟主机。

就是说你的虚拟主机应该添加两个,一个80 一个81
您需要登录后才可以回帖 登录 | 注册

本版积分规则

快速回复 返回顶部 返回列表