开发者

Problem with virtual host on Apache 2 - Not directing to appropriate virtual host

开发者 https://www.devze.com 2023-02-19 22:29 出处:网络
So I have two different sites on the same IP. Basically I just want to direct 开发者_Python百科traffic from one domain to a certain folder, and from another domain to a different folder. I read this p

So I have two different sites on the same IP. Basically I just want to direct 开发者_Python百科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!


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.


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 ?


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号