LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-08-2005, 05:37 AM   #1
JJX
Member
 
Registered: Mar 2004
Location: Greece
Distribution: Debian
Posts: 351

Rep: Reputation: 31
Apache 2 lan & internet


I want apache2 serve the same pages to my lan and to internet
My config:

Code:
NameVirtualHost 10.19.146.161:80
................................
<VirtualHost 10.19.146.161:80>
     ServerAdmin root@localhost
     DocumentRoot /var/www/mysite
     ServerName mysite.com
     ErrorLog /var/log/apache2/mysite.log
</VirtualHost>
.................................
<VirtualHost *:80>
     ServerAdmin root@localhost
     DocumentRoot /var/www/mysite
     ServerName mysite.homeip.net
     ErrorLog /var/log/apache2/mysite_inet.log
</VirtualHost>
Mysite on lan works fine
When i try to access the site from internet i see apache2's default page.
However, i can access the site using mysite.homeip.net/mysite and i am facing some problems (page not found problems - work perfecy on lan)

Do i have to define a new NameVirtualHost ? (my ip is dynamic)
I dont have any firewall (closed until i get it working), and NAT/PAT seems to work (i get the default).
 
Old 03-08-2005, 08:03 AM   #2
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
Now, firstly I dont understand why do you have to use virtual hosts for your situation at all.. But im gona ssume you have a good reason for it.

I just figured a few hours ago how the virtualhosts actually work.. So, basing on that, id suggest you try out this virtualHost config:
Code:
NameVirtualHost *:80

# LAN
<VirtualHost *:80>
DocumentRoot /var/www/mysite
ServerName mysite.com # a LAN domain pointer
</VirtualHost>

# PUBLIC
<VirtualHost *:80>
    DocumentRoot /var/www/mysite
    ServerName mysite.homeip.net # a public domain for your site
ServerAlias *.mysite.homeip.net # you prolly dont need this, my subdomains do.. 
</VirtualHost>
I dont guarantee itll work, but worth a try..
 
Old 03-08-2005, 08:06 AM   #3
hanzerik
Member
 
Registered: Jan 2002
Location: Cheyenne Wyoming
Distribution: Debian/Raspbian/Mint
Posts: 717

Rep: Reputation: 32
Is there a reason you are using Virtual hosts? No need to if all you want to do is serve the same pages/site for both LAN and WAN.


Check out http://www.no-ip.com, they have a program to automatically check for changes in your assigned IP, and when it detects a change it will update the dns records.
 
Old 03-09-2005, 04:53 PM   #4
@ngelot
Member
 
Registered: Oct 2004
Posts: 84

Rep: Reputation: 15
I've got some of the same problem:

I can't get this to work:

I'm trying to get me1.homeftp.org to point to /var/www/ and me2.shacknet.nu to /var/www/me2/

Code:
NameVirtualHost me1.homeftp.org
NameVirtualHost me2.shacknet.nu

<VirtualHost me1.homeftp.org>
     ServerAdmin admin@me1.homeftp.org
     DocumentRoot /var/www/
     ServerName me1.homeftp.org
</VirtualHost>

<VirtualHost me2.shacknet.nu>
     ServerAdmin admin@me1.homeftp.org
     DocumentRoot /var/www/me2
     ServerName me2.shacknet.nu
</VirtualHost>
For both me1.homeftp.org and me2.shacknet.nu I get to /var/www, but I want me2.shacknet.nu to point to /var/www/me2

What am I doing wrong?
 
Old 03-10-2005, 04:46 AM   #5
Artanicus
Member
 
Registered: Jan 2005
Location: Finland
Distribution: Ubuntu, Debian, Gentoo, Slackware
Posts: 827

Rep: Reputation: 31
Quote:
Originally posted by @ngelot
I've got some of the same problem:

I can't get this to work:

I'm trying to get me1.homeftp.org to point to /var/www/ and me2.shacknet.nu to /var/www/me2/

Code:
NameVirtualHost me1.homeftp.org
NameVirtualHost me2.shacknet.nu

<VirtualHost me1.homeftp.org>
     ServerAdmin admin@me1.homeftp.org
     DocumentRoot /var/www/
     ServerName me1.homeftp.org
</VirtualHost>

<VirtualHost me2.shacknet.nu>
     ServerAdmin admin@me1.homeftp.org
     DocumentRoot /var/www/me2
     ServerName me2.shacknet.nu
</VirtualHost>
For both me1.homeftp.org and me2.shacknet.nu I get to /var/www, but I want me2.shacknet.nu to point to /var/www/me2

What am I doing wrong?
If you start your httpd with the parameter S, what does it tell you?
Code:
httpd -S
Its a switch to closely evaluate the virtual hosts config..
 
Old 03-10-2005, 06:09 AM   #6
JJX
Member
 
Registered: Mar 2004
Location: Greece
Distribution: Debian
Posts: 351

Original Poster
Rep: Reputation: 31
httpd -doesnt exist anymore (or at least debian distro)

try: apache2ctl -S


Also change
NameVirtualHost me1.homeftp.org
NameVirtualHost <IP>

<IP>= ip of the interface where gets the inet (eth to router or something like that)
 
  


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
No Internet but LAN and VPN connect LAN work fine??? xavior SUSE / openSUSE 7 11-09-2005 01:14 PM
Stable IP&Viewing IPs&Spying in LAN mohtasham1983 Linux - Newbie 7 06-15-2005 03:16 PM
Mandrake 9.2 Lan & Internet problems [ALS]Fenix Mandriva 0 05-12-2004 11:23 AM
how to connect to the internet in a win98 lan & wingate 5.0.7 proxy server? GNULINUX_NEWBIE Linux - Newbie 1 01-14-2004 10:37 PM
route to alcatel modem/router: LAN & internet HerrBee Linux - Networking 0 06-11-2003 02:16 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:10 AM.

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