Recommended Posts

Hey

Im trying to get a web site hosted inside of my LAN so people can test it out. Its ran by Apache to be exact but I just cant seem to get it to work inside of my network. The only way I can get it to work is by editing the hosts file on each PC and pointing them at my IP resolving a FQDM (test.dev).

How can I do this? I have access to the router that forwards ports (although this may or may not have to do with anything)

Link to comment
https://www.neowin.net/forum/topic/1069600-interally-hosting-a-web-site/
Share on other sites

if you host a single site on that server by taping the ip (or name) they should open it. If not you need virtual hosts (define new site and enable it) and editing the host on each computer. Or you can setup apache to listen on another port for this site and do port forwading - like router ip:81 --> redirecting to server_ip:81 (or something)

you need virtual hosts (define new site and enable it) and editing the host on each computer

That is EXACTLY what I am currently doing and want to avoid it. I do not want to edit the host on each computer.

Going to the IP address of the site does not work, because it tries to go to "http://www.test.dev" which is not the site....

Well if you want the computers on your site to be able to resolve test.dev -- then setup local dns to do that! Editing the host file for every machine would not be the way to do it ;)

Going to www.test.dev when you go to http://ipaddress

Points to apache doing that on a redirect. You can clearly serve up a site off an IP quite easy with apache. When you say your going to the ipaddress of the site -- you do mean the private IP of the machine the apache is running on, and not your public IP correct?

Since its private, you could have apache listening on 100's of IPs to serve up 100's of different sites, etc. So you could get by without having to setup host headers/virtualhost/etc

Do you run Active Directory at this location? If so you already have DNS you could create a test.dev zone, etc.

Well if you want the computers on your site to be able to resolve test.dev -- then setup local dns to do that! Editing the host file for every machine would not be the way to do it ;)

Going to www.test.dev when you go to http://ipaddress

Points to apache doing that on a redirect. You can clearly serve up a site off an IP quite easy with apache. When you say your going to the ipaddress of the site -- you do mean the private IP of the machine the apache is running on, and not your public IP correct?

Yes. 192.168.100.73 which is my private IP of my PC on this LAN

Do you run Active Directory at this location? If so you already have DNS you could create a test.dev zone, etc.

No.

So your saying when you go to http://192.168.100.73 it redirects to http://www.test.dev

so what is in your host file on a machine that does this?

And what is your apache config look like? Do you have a .htaccess file with any sort of redirects in it?

so from a cmd prompt on a machine when you do

ping 192.168.100.73

What does the ping respond with, just the ip or does it return www.test.dev ?

If you want to setup DNS for your network - grab isc bind, runs on windows just fine. Or if you have a windows server OS, then you can install the dns role and create whatever zones and hosts you want. Or if you don't want to mess with full dns product like bind, you could grab tftpd32 which has a dns feature, that you could use to resolve test.dev, etc. etc.

http://tftpd32.jounin.net/

Tftpd32 is a free, opensource IPv6 ready application which includes DHCP, TFTP, DNS, SNTP and Syslog servers as well as a TFTP client.

So in your apache config, you sure you don't have something like this setup?

<VirtualHost *:80>

Redirect permanent / http://www.test.dev/

</VirtualHost>

So your saying when you go to http://192.168.100.73 it redirects to http://www.test.dev

so what is in your host file on a machine that does this?

Yes. If I put this in a hosts file on a machine

192.168.100.73 test.dev

It works. But I would have to go machine by machine...

so from a cmd prompt on a machine when you do

ping 192.168.100.73

What does the ping respond with, just the ip or does it return www.test.dev ?

If it is not in the hosts, it does not return test.dev

you could grab tftpd32 which has a dns feature, that you could use to resolve test.dev, etc. etc.

http://tftpd32.jounin.net/

Tftpd32 is a free, opensource IPv6 ready application which includes DHCP, TFTP, DNS, SNTP and Syslog servers as well as a TFTP client.

I thought about this as well but if I set this up wouldnt all other users on the network also have to point to me, a new DNS server? Kinda defeats the purpose....

So in your apache config, you sure you don't have something like this setup?

<VirtualHost *:80>

Redirect permanent / http://www.test.dev/

</VirtualHost>

I skipped over the first apache config question since you reasked it again in the same post. I have this setup in my httpd-vhosts.conf :

<VirtualHost *:80>

ServerAdmin [email protected]

DocumentRoot "C:/test"

ServerName test.dev

ServerAlias test.dev

<Directory "C:/test">

Options Indexes FollowSymLinks Includes execCGI

AllowOverride All

Order Allow,Deny

Allow From All

</Directory>

ErrorLog "logs/test.dev-error.log"

CustomLog "logs/test.dev-access.log" combined

</VirtualHost>

"a new DNS server? Kinda defeats the purpose...."

NO not really -- if you not going to run dns, how do you expect users to resolve test.dev to your IP without a host file? If you current dns does not allow you to create Records to resolve, then your going to have to fire up one that does and use it. Or you going to have to use host files on each machine, or you going to have to use IP address directly.. How else do you think you can resolve a fqdn??

DNS can be handed via dhcp, so you don't have to touch any box to get them to point to your dns.

You clearly have done something either with the site or apache itself to change the to www.test.dev when you access http://ipaddress

Here I just fired up apache on my test linux box. apt-get install apache2

And there you go access of site via IP with no redirects.. So either you messed with the config of apache, edited the .htaccess file or the page your loading from the site is doing the redirect.

What is the source of the site your serving up have in its headers? Are you doing something like

&lt;meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com"&gt;

post-14624-0-58885600-1334160548.jpg

I even added your ServerName and ServerAlias tags -- those have nothing to do with redirection

<VirtualHost *:80>

ServerAdmin webmaster@localhost

DocumentRoot /var/www

ServerName test.dev

ServerAlias test.dev

"a new DNS server? Kinda defeats the purpose...."

NO not really -- if you not going to run dns, how do you expect users to resolve test.dev to your IP without a host file? If you current dns does not allow you to create Records to resolve, then your going to have to fire up one that does and use it. Or you going to have to use host files on each machine, or you going to have to use IP address directly.. How else do you think you can resolve a fqdn??

Internally, I dont care if they resolve test.dev or not. I want the internal site to work.

You may have not read correct but if they go to

http://192.168.100.73

they cannot see the site either. And yes, they can ping me.

The only way they can see my site is by editing their host file and putting

192.168.100.73 test.dev

then they can access http://192.168.100.73 AND http://test.dev

You clearly have done something either with the site or apache itself to change the to www.test.dev when you access http://ipaddress

Well, not sure what files to look at although Im almost certain Ive only touched that one. This is a Magento site if it makes any difference.

What is the source of the site your serving up have in its headers? Are you doing something like

&lt;meta http-equiv="REFRESH" content="0;url=http://www.the-domain-you-want-to-redirect-to.com"&gt;

Havent done this either.

So you setup this package http://www.magentocommerce.com/

Look at the index.html file or index.php file, etc. in you c:/test folder-- many of these canned sites have redirects built into them.. So yeah you hit http://ipaddress and right away your redirected to http://www.test.dev which no is not going to work, so nothing is going to be shown in the browser.

I have not used this application so would have to install it to see what it does out of the box.

edit: Ok just hit up a demo admin page, and yeah this could be an issue

post-14624-0-70314700-1334162753_thumb.j

It defaults to redirect vs no, and then there is also a setting in here that redirects to base url if cookies disabled, etc..

So your redirect is to www.test.dev that could be your problem right there, if the client can not resolve that.

So you need to either disable this redirection stuff, change it to IP address. Or use your host file, or setup dns.

Here is installation manual:

http://www.magentocommerce.com/wiki/1_-_installation_and_configuration/magento_installation_guide

You could try to run it on wamp server for windows or you could configure some Linux to serve it (it is required, based on manual). It seems to me like normal installation, make database in phpmysql, unzip archive in web folder and go to http://192.168.100.73/folder_where_are_magento_files.

Also, pay attention to this:

During the installation process Magento will set cookies and most browsers will refuse to accept cookies for localhost. This can lead to several problems but no error messages. E.g. when trying to set the locale the page will just refresh and revert to the standard En-US locale..

To avoid this problem, you can set up Magento to use 127.0.0.1 as its domain name or create another entry for localhost in your computer?s /etc/hosts file and use that hostname to access the site, as shown below:

There was something in there that stated if cookies not working, redirect to base url. So yeah if trying to set cookie for localhost, which browser refuses -- if your base url is www.test.dev then sure would explain what is happening.

Per your other thread seems like this site will be hosted elsewhere, this seems like a good idea to me ;)

There was something in there that stated if cookies not working, redirect to base url. So yeah if trying to set cookie for localhost, which browser refuses -- if your base url is www.test.dev then sure would explain what is happening.

But technically since they are other IPs, they arent localhosts.......

Per your other thread seems like this site will be hosted elsewhere, this seems like a good idea to me ;)

It will :) This was just for some internal testing.

Hosting it somewhere else is another complete challenge which I have never in my life done...

"But technically since they are other IPs, they arent localhosts......."

Which has nothing to do with the name on the cookie that application might set.

Fix up your redirect stuff in the admin page of that web app and you should be able to use http://ipaddress vs host name, etc. Which should remove your need for host file entries or dns.

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • This article does not make sense and it’s very evident, the bug wasn’t confirmed to exist, because the application itself runs on editions of Windows which make it impossible to run Hyper-V VMs on, “Basically, Claude Desktop on Windows spins up a 1.8GB Hyper-V virtual machine if you use Claude Cowork or agent mode even once.”, suggests the bug is caused by something else otherwise it would only happen to users with the capability of running Hyper-V VMs and that’s only if Hyper-V was enabled which is by default not enabled. The true issue is that the author who reported the bug used the incorrect terminology.
    • “To prevent hallucination issues and keep the database clean, the platform uses a multi-agent verification loop to check code quality.” - This absolutely isn’t happening. ”Before the massive rise of LLMs, which tanked its traffic by about 50% over the last couple of years, Stack Overflow was the go-to website for millions of programmers seeking coding solutions.” - It still is trusted, because the community of users, blocked other users from submitting false and misleading answers generated by AI agents that can be convinced something it generated is actually incorrect even if it’s actually correct. The company itself doesn’t know what it wants to be so it keeps trying and failing to introduce AI features to the platform. This effort will also fail, already submitted one successful poison pill, look forward to generating more.
    • Faster? MBP M5 Max, I have 4k video renders running faster than Teams.
    • Completely irrelevant as long as pricing is garbage. With OneDrive I get storage for about $18 / TB for a year. With Proton it's $96. For the record, Google One is around $48, Dropbox $69, iCloud $60. In other words, Proton is the worst value BY FAR. Not to mention with OneDrive I get full desktop and web office suites for 6 people.
  • Recent Achievements

    • One Month Later
      Sopa flores earned a badge
      One Month Later
    • First Post
      StaticMatrix earned a badge
      First Post
    • Week One Done
      StaticMatrix earned a badge
      Week One Done
    • Rookie
      lamborghiniv10 went up a rank
      Rookie
    • One Month Later
      pinnclepd earned a badge
      One Month Later
  • Popular Contributors

    1. 1
      +primortal
      524
    2. 2
      PsYcHoKiLLa
      211
    3. 3
      +Edouard
      159
    4. 4
      Steven P.
      98
    5. 5
      ATLien_0
      82
  • Tell a friend

    Love Neowin? Tell a friend!