You are not logged in.

#1 2018-11-26 15:37:17

From: Western NC, US
Registered: 2015-09-29
Posts: 228

Making a vhost the default webroot for lan/wan

hi there everyone!

I'm installing a wampstack on Windows 10.  It's from and it's working fine.  MySQL is accessible to the local network and I can visit localhost and website1 on the local machine and get to the docroot of each.

The issue I have is that I'd like for website1 to the be docroot reached from the lan/wan and I'm not sure how to do that.  Here's the vhosts file:

# Virtual Hosts
<VirtualHost *:80>
  ServerName localhost
  ServerAlias localhost
  DocumentRoot "${INSTALL_DIR}/www"
  <Directory "${INSTALL_DIR}/www/">
    Options +Indexes +Includes +FollowSymLinks +MultiViews
    AllowOverride All
    Require local

<VirtualHost *:80>
    ServerName website1
    DocumentRoot "d:/websites/website1"
    <Directory  "d:/websites/website1/">
        Options +Indexes +Includes +FollowSymLinks +MultiViews
        AllowOverride All
        Require local

How do I manage to do that?

Thanks for your time!! A social site with an identity crisis.


#2 2018-11-26 18:25:02

From: Edrychwch o'ch cwmpas
Registered: 2015-09-29
Posts: 640

Re: Making a vhost the default webroot for lan/wan

How are you connected to the lan/wan (internet)? By which device?

Basically, you have to:
1. on your router for wan, you have to configure NAT for port 80 - this is called configuring port forwarding (typically done via web interface), and make it redirected to your local ip (win10 server)
2.(*) you have to discover your router wan ip (as seen from the world), and then they can browse your entire local web server
3. only after you have completed 1. and 2., you have to change your web server configuration (vhosts files); for example, you can insert somewhere inside 'localhost' vhost file the directive to make it accessible from all your local IPs, except from your router (this is certain combination of the 'Require' directive(s))

I'm afraid, your question is a bit complex (if I got it right), and the solution is not straightforward, as includes lots of other information, especially the information how are you connected to wan, and how the router interface looks and works (this might even be locked by your internet provider).

I suggest solving this entire problem step by step: first 1., check that it works, then step 2 ... and so on.

(*)Depending how are you connected to the internet your 'world'-IP can change on daily basis (the so called 'dynamic address'). This problem can be solved by free services like NO-IP or similar.

EDIT: added words 'port forwarding' in 1., which is the actual term for this

Last edited by iMBeCil (2018-11-26 20:30:56)

Postpone all your duties; if you die, you won't have to do them ..


Board footer

Powered by FluxBB