Website-Redirect to public_html only for a single VServer ?!

8 posts / 0 new
Last post
#1 Sat, 01/08/2011 - 10:02
meon

Website-Redirect to public_html only for a single VServer ?!

I am trying to host without Domains / DNS pointers. I Disabled BIND and all DNS- and Mailservices even in the RC conf as starting processes.

Access to public_html without Virtualmin-Login (Preview) is neccessary.

I've read "Access virtual server without domain name"

http://www.virtualmin.com/node/7374

but couldn't find "Virtual server creation" section.

I've read "url to access preview website"

http://www.virtualmin.com/node/14335#comment-70681

and created 2 Redirects for 2 Vservers as described:

/domainA.tld --> /home/domainA/public_html

/domainB.tld --> /home/domainB/public_html

But that behaves strange: - Doesn't work for Redirects called like the VServer ( /domainA ) - Subdirectories are always includes even if disabled. - Only one Redirect works - the first that's been created.

I think that the first created (or the single available) owns the Servers Redirect-Rights AND local IP, because it is directed to the according public_html ( http://serverIP/ from LAN).

I haven't tried to work with Vmin in WAN yet as follow up...

Is there a possibility to Redirect multiple Vservers anyhow??? Without DNS Records of course.... and preferred also without multiple IP's.

Regards mEon

Vmin & Webmin 3.82.gpl Debian Lenny

Sun, 01/09/2011 - 17:32
Locutus

Well, for Virtualmin to be able to serve any website, an externally resolvable hostname of SOME kind is necessary. :) Can you please give more details as to how you set up your domains so far? What is the domain that has external DNS entries, and where do you wish to serve them from?

Wed, 01/12/2011 - 04:34
meon

First of all, i'd like to serve them locally - no editable DNS, only serveral /etc/hosts. Meaning there are no Domains served, access via IP. That's the problem i need to solve.

Running services: Apache, Proftpd, MySQL, PostgreSQL. Tomcat planned - there's no module available for, right?

Thanks for your reply! Regards

Wed, 01/12/2011 - 11:03
Locutus

Sorries, I don't have time right now to get into details about this kind of forwarding / redirects, but I can suggest some read from the Apache documentation (since you'll quite probably have to manually configure stuff there if you wish to serve multiple sites without domain names etc.).

http://httpd.apache.org/docs/2.2/en/vhosts/

http://httpd.apache.org/docs/current/mod/mod_alias.html

http://httpd.apache.org/docs/current/mod/mod_rewrite.html

My suggestion though would be to set up the domains the "intended" way, possibly with a local-only domain like ".lan" or ".local", and then configuring the machines you wish to test it from to use the Virtualmin host as nameserver. That will probably save you quite some hassle.

Thu, 01/20/2011 - 15:04
meon

Thanks for your ideas, i'll verify them for practicability but they're actually all sympatic... I'll report.

Mon, 02/28/2011 - 01:50
meon

Access to the Vhosts only works by having a DNS (DomainNameServer), but not as it would be comfortable for testing by redirects from the Server's IP as e.g. http://xxx.xxx.xxx.xxx/vserver1/ -> this only works with lot's of time and modification of apache's vhost files.

There are 2 ways to gain the working testserver: (1)with or (2)without a domain you bought before and use!!! The keyword ist DynDNS with !!! wildcard !!! support. Your server will be reachable from WAN.

The following is all at your own risk, if you do one of the described actions/ howto's ;)

1.) If you have (or bought) a domain for the Testserver - e.g. xyz.com

  • create an account at zoneedit.com, create a zone xyz.com, modify xyz.com
  • as NS-Records choose 2 different Nameservers (default, nsX.zoneedit.com)
  • as A-Record insert "@" in the 1st field and your router's actual WAN-IP.
  • add a 2nd A-Record, all similar but "www" in the 1st field (for http://www.)
  • e.g. use Google-Apps: emails@xyz.com (max 50x7GB for free)
    - then create the MX-Records as google-Apps describes
  • you always have to validate before saving before publishing your zone changes.

  • you can also check your Zone-Config by using one of the choosen NS-Servers
    - http://www.kloth.net/services/nslookup.php and lookup for "Any" record.

  • Now make your home Routing Device zoneedit-DynDNSable
    -by googling "Your Devicename, zoneedit"
    - Speedport-Devices: Lorus Blog
    - Fli4L Linux Routers: http://portfolio16.de/dyndns/provider-ZONEEDIT
    - For every Subdomain you need to generate a cronjobbed script to Update IP, eg. the delivered one 3 Posts further!

  • If Update-URL, Domain-Name, Username and Password are correct: your router always tells its IP to the DNS.
  • Then, in your Routing Device, you have to forward the following Ports to your Server's fix Local (LAN) IP e.g. 192.168.1.10
    - 80 for http://, 10000 for Virtualmin/Webmin, 21(22) if you want ftp(ssh) from WAN, 443 if you use SSL-Sites.
    - for Mail etc. Ports if necessary, please google.

  • Now it's getting serious. Change the DNS of your ip:

  • At your Domain-Seller's Web-Config you may have Access to s.th like "DNS", "Whois-Data" or else
    --- Find out the IP's of the 2 Servers (nsX.zoneedit.com): http://www.hidemail.de/blog/findtheip.shtml
    --- Create the 2 Zoneedit DNS-Servers, and select them for the Domain
  • If you don't have access to the DNS-Settings, you have to contact your Domain-Seller for changing them.

  • After 2h -2days your DNS-Change should have reached the rest of the world's DNS

  • Now (or inbetween), in Virtualmin you can create 2 kinds of Vservers: one xyz.com and lots of xxxx.xyz.com's:

  • 1st make a Vserver with domain xyz.com -> Servername the is xyz, URL: http://xyz.com (+www)
    - Create a "hello world" index.html and upload it to "pubic_html" after ftp-login with name xyz +pw.
    - if DNS-Change for the domain succeeded http://www.xyz.com shout show your "hello world".
  • Now you can make a 2nd Vserver called e.g. Vserver1.
    - Domain then must be vserver1.xyz.com in the 1st field of the Vserver-creation-form.
    - Now upload a index.html into "public_html" after ftp-login with name vserver1 and password
    - Log in to your zoneedit account, edit your zone xyz.com and create another A-Record
    - The new A-Record must be similar to all others, but in the 1st field you write "vserver1" (not @ or www)
    - After a while http://vserver1.xyz.com should show your index.html that you uploaded in public_html.

2.) Without owing a TLD (ToplevelDomain) you need a DynDNS Service that supports Wildcards. ---> Attention! At dyndns.org you have to pay for wildcards. Watch e.g. http://portfolio16.de/dyndns/index

Although wildcards cost, i'll use dyndns.com in my example:

  • Create an account e.g. xyz.dyndns.com
  • You don't have to manage any DNS-Zone, only
  • Configure your Routing Device for dyndns
  • your 1st Virtualmin-Vserver the must be called xyz also, but with domain xyz.dyndns.com
  • your possibly lots of 2nd Vservers then must be called vserver1 also, but domain vserver1.xyz.dyndns.com
    - in your DynDNS-Account, create a Wildcard for vserver1(.xyz.dndns.com)
  • as you realize, the only difference to 1.) is that between xyz and .com is a .dyndns (e.g.).
    - and you don't have to manage DNS-Zones or DNS-Records at Domain-Sellers.

sorry for very short 2nd howto, didn't have to practice it.

Regards, mEon

Sun, 02/27/2011 - 03:27
meon

In one case, i had the problem that the automatically dynamic IP updating process of the routing device only refers to the 1st 2 a-Records: "@" and "www".

Every other A-Record has NOT BEEN UPDATED!

Solution:

wget -O - --http-user=YOUR-ZE-USERNAME --http-passwd=YOUR-ZE-PASSWORD 'http://dynamic.zoneedit.com/auth/dynamic.html?host=vhostX.xyz.com'

(as before, vhostX and xyz.com have to be replaced by your TLD / vhost- & A-Record-Name.)

Mon, 02/28/2011 - 01:53
meon

I wrote a script: zoneedit-skriptgenerator.sh (German)

  • generates a bash-Skript for every Vhost: /root/zoneedit/vhostname.xyz.com
  • logging in /root/zoneedit/log/vhostname.xyz.com.log (logs only changes+time)

  • automatically adds the vhost-bash script to root's crontab for beeing periodically executed

  • The Sub Skripts checks the Ip's of the A-Records and the Server's WAN Ip

  • If they are different, it updates zoneedit immediatelly

  • FOR REMOVAL: delete the Vhost-File in /root/zoneedit and remove it's line in crontab -e

Topic locked