简体   繁体   中英

Configuration: DNS or Apache

I have the following problem. I have two domains: www.domain1.de and www.domain2.de I also have path is on Jelastic server where to find my PHP page myphpsite.jelastic.dogado.eu.

Now I wanted to do the following.

1) If I go to www.domain1.de, then should address bar of the Web Browser www.domain1.de be displayed, but the page is fetched from myphpsite.jelastic.dogado.eu.

2) When I go to www.domain2.de, then should address bar of the Web Browser www.domain2.de be displayed, but the page is fetched from myphpsite.jelastic.dogado.eu / admin /.

so

1) www.domain1.de -> myphpsite.jelastic.dogado.eu 2) www.domain2.de -> myphpsite.jelastic.dogado.eu / admin /

The first one I can do by CNAM Record

But we can I solve the second problem without frames?

thank you

This is just a matter of configuring Apache VirtualHosts (assuming that you're using Apache), or Nginx Server Blocks (if you're using Nginx). Leo's link can help you with either of them, within a Jelastic context (where to find those config files etc.): http://docs.jelastic.com/multiple-domains-php

Here's a quick example for Apache:

<VirtualHost *:80>
    DocumentRoot /var/www/webroot/ROOT
    ServerName domain1.de
    ServerAlias www.domain1.de
</VirtualHost>

<VirtualHost *:80>
    DocumentRoot /var/www/webroot/ROOT/admin
    ServerName domain2.de
    ServerAlias www.domain2.de
</VirtualHost>

You might also wish to define different log files for each domain etc. There are many possibilities, and since Jelastic gives you direct access to the server config. files you can configure almost anything that you could want here. It's just a matter of reviewing the Apache (or Nginx) docs and trying it out.

Notes:

  1. Beware that the Jelastic default configuration defines a wildcard to catch all requests. You need to place your custom configuration before that (either literally, or via an include), or else overwrite the default VirtualHost configuration block - otherwise your config. will not have any effect.
  2. The above example handles HTTP only. If you need to handle HTTPS, you need to configure this separately. (eg :443 instead of :80)
  3. Remember that you need to restart Apache (or Nginx) for config. changes to take effect.

See also:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM