Apache 2 上的虚拟主机出现问题 - 未定向到适当的虚拟主机

发布于 2024-10-26 18:55:56 字数 425 浏览 3 评论 0原文

所以我在同一个 IP 上有两个不同的站点。基本上我只想将流量从一个域引导到某个文件夹,并将流量从另一个域引导到另一个文件夹。我读了这个页面... http://httpd.apache.org/docs/ 2.0/vhosts/examples.html,并将我的启用站点的配置文件设置为看起来像这样,但我的第二个域只是将流量路由到我的原始站点。

所以... 域名 1: cdphoto.uni.cc 域 2:wtfdoidoatubc.uni.cc

我的配置文件看起来像 这个

感谢您的任何建议!

So I have two different sites on the same IP. Basically I just want to direct traffic from one domain to a certain folder, and from another domain to a different folder. I read this page... http://httpd.apache.org/docs/2.0/vhosts/examples.html, and set up my sites-enabled configure file to look like that, but my second domain just routes traffic to my original site.

So...
Domain 1: cdphoto.uni.cc
Domain 2: wtfdoidoatubc.uni.cc

And my configure file looks like this

Thanks for any suggestions!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

遥远的绿洲 2024-11-02 18:55:56

在这种情况下,最好使用控制面板并添加重定向,除非您打算将站点的主要部分用于某些目的。但如果没有来自主机控制面板的重定向规则将是最好和最简单的选择。

In this case it would be a good idea to use your control panel and add a redirect unless you plan to use the main part of your site for something. But if not a redirect rule from your host control panel would be the best and easiest option.

翻了热茶 2024-11-02 18:55:56

也许尝试使用 DocumentRoots /var/www/site1 和 /var/www/site2 ?现在第二个站点位于第一个站点的子文件夹中。如果您请求 http://www.cdphoto.uni.cc/wtf 会发生什么?

Maybe try to use DocumentRoots /var/www/site1 and /var/www/site2? Now the second site is in a subfolder of the first. What would happen if you request http://www.cdphoto.uni.cc/wtf ?

任谁 2024-11-02 18:55:56

我会尝试一下,并确保您注意到我对第一个文档根目录所做的更改。

    <VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/cdp
    ServerName www.cdphoto.uni.cc
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/cpd>
        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 /var/log/apache2/error.log

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

    CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    <Location /trac>
        SetHandler mod_python
        PythonInterpreter main_interpreter
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnvParentDir /var/www/trac
        PythonOption TracUriRoot /trac
    </Location>

</VirtualHost>
    <VirtualHost *:80>
        DocumentRoot /var/www/wtf
        ServerName www.wtfshouldidoatubc.uni.cc
    </VirtualHost>

I would give this a try and make sure you take note of the change I made to the first document root.

    <VirtualHost *:80>
    ServerAdmin webmaster@localhost

    DocumentRoot /var/www/cdp
    ServerName www.cdphoto.uni.cc
    <Directory />
        Options FollowSymLinks
        AllowOverride None
    </Directory>
    <Directory /var/www/cpd>
        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 /var/log/apache2/error.log

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

    CustomLog /var/log/apache2/access.log combined

    Alias /doc/ "/usr/share/doc/"
    <Directory "/usr/share/doc/">
        Options Indexes MultiViews FollowSymLinks
        AllowOverride None
        Order deny,allow
        Deny from all
        Allow from 127.0.0.0/255.0.0.0 ::1/128
    </Directory>

    <Location /trac>
        SetHandler mod_python
        PythonInterpreter main_interpreter
        PythonHandler trac.web.modpython_frontend
        PythonOption TracEnvParentDir /var/www/trac
        PythonOption TracUriRoot /trac
    </Location>

</VirtualHost>
    <VirtualHost *:80>
        DocumentRoot /var/www/wtf
        ServerName www.wtfshouldidoatubc.uni.cc
    </VirtualHost>
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文