LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices


Reply
  Search this Thread
Old 12-04-2004, 10:18 PM   #1
Terra Niux
Member
 
Registered: Nov 2004
Posts: 36

Rep: Reputation: 15
External IP for Virtual Server


Hello i'm using Virtualmin to create virtual servers however im still quite new to the idea of using these virtual servers, I understand that I can modify the default apache server then people can access this default server via the external IP say http://60.240.96.175:80 and I can access via the internal IP http://10.0.0.10 or localhost my question is that if I create a virtual server how can I access it externally over the internet without getting the default website to appear but the virtual server instead?

I hope I am being clear enough, thanks for your help.
 
Old 12-04-2004, 10:38 PM   #2
linux_terror
Member
 
Registered: Aug 2004
Location: Northbrook, Illinois
Distribution: CentOS-5
Posts: 311

Rep: Reputation: 30
at the bottom of your http.conf you sould see a section called VirtualHosts, this is where you will add the virtual hosts, there are many different techniques for this, assuming that you will be using name based virtual hosting as opposed to ip based virtual hosting tou will also want to uncomment the line that says NameVirtualHost 192.168.0.4:80 substituting the address for your NIC's local address.

here's an example of a virtualhost entry

<VirtualHost 192.168.0.4:80>
ServerAdmin webmaster@example.com
DocumentRoot /var/www/html
ServerName example.com
ErrorLog logs/example.com-error_log
TransferLog logs/example.com-access_log
</VirtualHost>

These entries can get very complex depending on what you want to do, I'd suggest starting out simple.

Hope this helps,
linux_terror
 
Old 12-04-2004, 10:43 PM   #3
Terra Niux
Member
 
Registered: Nov 2004
Posts: 36

Original Poster
Rep: Reputation: 15
Okay let's say that I am not using any names at the moment just IP addresses, a person accessing the virtual server from the internet cant access the virtual interface IP tho can they? I want people from the internet to be able to view the virtual servers aswell say like a web host how they have many different users.. i'm quite confused. The default server uses 10.0.0.10 this can be accessed by my internet IP but the virtual server uses 10.0.0.11 what IP can I give people to access this? I am not using DNS or names atm tho.
 
Old 12-04-2004, 10:45 PM   #4
Terra Niux
Member
 
Registered: Nov 2004
Posts: 36

Original Poster
Rep: Reputation: 15
Can virtual servers only be accessed by the internal network?
 
Old 12-04-2004, 11:25 PM   #5
linux_terror
Member
 
Registered: Aug 2004
Location: Northbrook, Illinois
Distribution: CentOS-5
Posts: 311

Rep: Reputation: 30
The only way I can think of to do what you are asking is a workaround, and that would be to set up permanent redirects for subdirectories of the main site to non-standard ports that are forwarded to the other local ip's by your router.
Its not the "right" way to go about it. If I were you I'd invest 6 dollars in a domain name and learn a bit about hosting your own dns. You could then at least set up subdomains to point to other websites. If you had multiple external(WAN) ip addresses to work with it would be possible but that would cost more than just getting a domain name anyway.

linux_terror
 
Old 12-05-2004, 12:18 AM   #6
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
Put it this way, basically there's 2 types of virtualhosts in Apache, ip-based and name-based.

With ip-based Apache serves content based on which ip address the client connects to(ie you have more than one public ip addresses, and you setup vhosts on each of them)

With name-based Apache checks the domain name which the client used to connect, and serves content based on that. If you configured name-based vhosts and client uses the ip address to connect , the default vhost will be used(usually the first one defined in the configuration file)

Therefore, for your situation if you have an ip-based configuration, why not just put the website you want external clients to see on the external IP, since they will only be able to access your public IP address anyway. If you're behind a router simply forward port 80 to whichever LAN ip the virtualhost is using on the server.
Also if you want to use name-based virtualhosts without purchasing a domain name there's plenty of free DNS services around, here's one I personally use:
http://www.afraid.org

For anything more complex you need to learn how to use mod_rewrite.

Last edited by Demonbane; 12-05-2004 at 12:20 AM.
 
Old 12-05-2004, 12:24 AM   #7
Terra Niux
Member
 
Registered: Nov 2004
Posts: 36

Original Poster
Rep: Reputation: 15
Basically what I want to do is to have at least 5 websites hosted for people, I want them to be able to log in via FTP into a folder which contains their websites and where they can update their websites, I then want apache to look into these directories. Are there any good tutorials on this sort of work? any examples? I am still confused on configuring domain names.
 
Old 12-05-2004, 12:47 AM   #8
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
The simplest way would be using mod_userdir
You put this in your Apache config file(might even be enabled already depending on your distro):
Code:
<IfModule mod_userdir.c>
   UserDir public_html
</IfModule>
Then create local user accounts for each user, their root web directory will be in ~/public_html. So for user "john", he has to upload his stuff to /home/john/public_html, and it can be accessed via http://yourserver/~john/

Using DNS for name-based virtualhost, eg john can access his website using http://john.yourdomain.com, is a little more complex. If mod_userdir does not achieve what you want let me know, I can give you another short tutorial.
 
Old 12-05-2004, 01:24 AM   #9
linux_terror
Member
 
Registered: Aug 2004
Location: Northbrook, Illinois
Distribution: CentOS-5
Posts: 311

Rep: Reputation: 30
BEWARE: If you add hosts using mod_userdir and have ssh/sftp access open to the outside these clients will be able to browse above their home directories.

It sounds like what you want to do is build a LAMP style mass hosting environment. There are many tutorials on this and it is quite an endeavor. If you need help just keep posting, I have set up quite a few of them. Demonbane is right, for your purposes now mod_userdir is probably the best way to go.

linux_terror
 
Old 12-05-2004, 01:31 AM   #10
Terra Niux
Member
 
Registered: Nov 2004
Posts: 36

Original Poster
Rep: Reputation: 15
Okay I tried modifying the Apache config, however I cannot seem to access my server from my Windows XP machine, the IP is http://10.0.0.10 but I cannot load http://10.0.0.10/~lindsay, can you tell me why? Although when I use Lynx and goto http://10.0.0.10/~lindsay I get the following error


Forbidden

You don't have permission to access /~lindsay/ on this server.
_________________________________________________________________


Apache/1.3.31 Server at server.lan Port 80


Do I have to chmod the directory or something?

Thanks
 
Old 12-05-2004, 01:34 AM   #11
linux_terror
Member
 
Registered: Aug 2004
Location: Northbrook, Illinois
Distribution: CentOS-5
Posts: 311

Rep: Reputation: 30
chmod 755 /home/lindsay /home/lindsay/public_html
 
Old 12-05-2004, 01:38 AM   #12
Terra Niux
Member
 
Registered: Nov 2004
Posts: 36

Original Poster
Rep: Reputation: 15
Unfortunately I still get the error after I did chmod 755 /home/lindsay,

Here is some information

root@server:/home# ls -l
drwxr-xr-x 4 lindsay users 4096 2004-12-04 04:43 lindsay/

root@server:/home# cd ~lindsay
root@server:/home/lindsay# ls -l
drwxr-xr-x 2 root root 4096 2004-12-04 04:43 public_html/
 
Old 12-05-2004, 01:42 AM   #13
linux_terror
Member
 
Registered: Aug 2004
Location: Northbrook, Illinois
Distribution: CentOS-5
Posts: 311

Rep: Reputation: 30
did u restart the webserver?

you'll also want to
Code:
chown lindsay:lindsaysgroup public_html
so that lindsay can write to it

Last edited by linux_terror; 12-05-2004 at 01:44 AM.
 
Old 12-05-2004, 01:53 AM   #14
Demonbane
LQ Guru
 
Registered: Aug 2003
Location: Sydney, Australia
Distribution: Gentoo
Posts: 1,796

Rep: Reputation: 47
Did you put any index files(index.htm etc) in public_html? I think the default Apache installation in most distro disallows directory browsing unless you specify otherwise.
 
Old 12-05-2004, 01:59 AM   #15
Terra Niux
Member
 
Registered: Nov 2004
Posts: 36

Original Poster
Rep: Reputation: 15
I just rebooted the box, now i've got another problem *sigh*

Failed to start apache : Apache does not appear to be running :
[Sat Dec 4 05:15:26 2004] [warn] NameVirtualHost 10.0.0.10:80 has no VirtualHosts
/usr/sbin/apachectl start: httpd started



Help me please
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Virtual Server LAdProg2005 Linux - Newbie 2 11-09-2005 12:14 PM
Virtual Server GeneralChaos Slackware 2 09-20-2005 07:32 PM
Apache virtual hosts for intranet and external site tawalker Linux - Software 12 06-25-2004 11:01 AM
Virtual Server ONOM Debian 1 09-30-2003 03:27 AM
Apache Virtual Server - 01 bkeating Linux - Software 5 12-05-2002 12:01 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Networking

All times are GMT -5. The time now is 11:05 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration