Allow Client To View Changes Without Live Server
Posted by: funkyfrank (---.98-139-19-46.swissinet.com)
Date: November 10, 2014 02:01PM

In this topic [forum.wampserver.com] I read in the section "ALSO:" [See that I have allowed this site to be accessed from the internet from within the VHOST definitions, this change will apply to only this site and no other. Very useful for allowing a client to view your changes for an hour or so without having to copy them to the live server.]

I have a few sites that show nicely in my browser by using a VirtualHost for them.

Question: How can I show those to the client on the live internet? What URL do I send the client? How do I make the locally hosted and served sites available to view from the internet?

I assume the first step is to set the WampServer to "online". But then how do I continue?

This is merely for the purpose of showing the site to the client with about as much security on my end as possible, i.e. I would not want the client to be able to hack me somehow while making the site available live.

Thank you for help with this.

Best
Frank

Version of Operating system? Windows 7 Ultimate 64bit
Version of Wamp Server installed? 2.5 32bit
Version of Apache you are running? 2.4.9
Version of MySQL you are running? 5.6.17
Version of PHP you are running? 5.5.12
What colour is your WampManager icon? Green
Host file localhost 127.0.0.1

New to WAMP?
Read this please: [forum.wampserver.com]

Options: ReplyQuote
Re: Allow Client To View Changes Without Live Server
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: November 10, 2014 03:02PM

I assume the first step is to set the WampServer to "online". But then how do I continue?

NO, once you start using Virtual Hosts you should leave the Put Online/Offline set to offline. This keeps localhost private to your PC.

You then just MANUALLY alter the access rights in the SPECIFIC Vhost you want to be visible to a client.


How to view from the internet :

1. Port Forward port 80 on your router to the internal ip of the PC running WAMPServer

2. Get a DYNAMIC DNS domain name ( DYNDNS.COM is what I use, but I think noip.com would also work )
This gets you a domain name, not a particularly nice one but one like xxxx.dyndns.net for example )

You then setup a second VH for the site xxxx specifying xxxx.dyndns.net as the ServerName

Then when an external user uses xxx.dyndns.net dyndns.com forward that to your WAN ip, then gets port forwarded to the PC running wamp by your router, Apache see's the domain name xxxx.dyndns.net looks at its VHOSTS and knows where to serve pages from.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-



Edited 1 time(s). Last edit at 11/11/2014 10:26AM by RiggsFolly.

Options: ReplyQuote
Re: Allow Client To View Changes Without Live Server
Posted by: funkyfrank (---.234.27.17.81.swissinet.com)
Date: November 11, 2014 09:25AM

Great explanation, thank you heaps!

I will go trough it step by step and try to get it to work.


Best Regards
Frank

Version of Operating system? Windows 7 Ultimate 64bit
Version of Wamp Server installed? 2.5 32bit
Version of Apache you are running? 2.4.9
Version of MySQL you are running? 5.6.17
Version of PHP you are running? 5.5.12
What colour is your WampManager icon? Green
Host file localhost 127.0.0.1

New to WAMP?
Read this please: [forum.wampserver.com]

Options: ReplyQuote
Re: Allow Client To View Changes Without Live Server
Posted by: funkyfrank (---.234.27.17.81.swissinet.com)
Date: November 12, 2014 03:12PM

1. Port Forward port 80 on your router to the internal ip of the PC running WAMPServer

Do you mean something like 192.168.188.45 where .45 is the PC I am doing the dev work on? So I forward port 80 to that IP or to another IP?

My router is on 192.168.188.1 and all the connected clients get an IP after 192.168.188 so I assume it is this IP you talk about?



I then signed up to noip.com. There I added a host, for example host1234.ddns.net.

With this example the VH would look like this?


<VirtualHost *:80>
DocumentRoot "D:/WEB DEV WORK/Client Projects/ETC/BLA BLA"
ServerName host1234.ddns.net
ServerAlias host1234.ddns.net
<Directory "D:/WEB DEV WORK/Client Projects/ETC/BLA BLA">
AllowOverride All
Require local
</Directory>
</VirtualHost>


Apache see's the domain name host1234.ddns.net looks at its VHOSTS and knows where to serve pages from.

But what VH will it serve pages from if there are multiple VH projects?

You then just MANUALLY alter the access rights in the SPECIFIC Vhost you want to be visible to a client.

So what other settings do I need to specify in the VH for access rights to this specific VH I like to share to the client?

Thank you for your help.

Kind Regards
Frank

Version of Operating system? Windows 7 Ultimate 64bit
Version of Wamp Server installed? 2.5 32bit
Version of Apache you are running? 2.4.9
Version of MySQL you are running? 5.6.17
Version of PHP you are running? 5.5.12
What colour is your WampManager icon? Green
Host file localhost 127.0.0.1

New to WAMP?
Read this please: [forum.wampserver.com]

Options: ReplyQuote
Re: Allow Client To View Changes Without Live Server
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: November 12, 2014 04:59PM

Do you mean something like 192.168.188.45 where .45 is the PC I am doing the dev work on? So I forward port 80 to that IP or to another IP?

YES

That makes any external access from the internet on port 80 get allowed into your internal network. The request is forwarded to the internal ip address you give it, and of course only if Apache is running and listening on port 80 will anything much happen. If Apache is not running the external access just gets an error saying basically nothing is there to reply to the connection attempt.


Ok so you have created a domain name of host1234.ddns.net on noip.com and got that forwarded to your routers WAN ip address. Thats all they do.

So the Virtual Host definition has to match this new domain name

<VirtualHost *:80>
   DocumentRoot "D:/WEB DEV WORK/Client Projects/ETC/BLA BLA"
   ServerName host1234.ddns.net
   ServerAlias www.host1234.ddns.net

   <Directory "D:/WEB DEV WORK/Client Projects/ETC/BLA BLA">
      AllowOverride All
      Require local                  <-- set to this to keep people out
      #Require all granted       <-- uncomment this line when you want people to be allowed access
   </Directory>
</VirtualHost>


So what actually happens here is

1. An external user uses the url host1234.ddns.net
2. the dns servers at noip.com cause that to be forwarded to your router
3. You router see an external connection coming in from the internet on port 80
4. I see that it is supposed to forward all connections on port 80 to your internal PC so it foes that
5. Apache is listening to port 80, so it sees the connection and looks at the url used by the remote user
6. It then looks at all of its Virtual Host definitions to see if it can find one with a ServerName or ServerAlias that matches the url on the connection.
7. If it finds one, it serves the site from the DocumentRoot specificed on that VH.
If it does not find a match it will server pages from the FIRST VH in the VH definition file.


Because of point 7 i.e. the default VH, you should always define localhost first in your VH definition file. And that definition should ALWAYS remain set to allow local connections ONLY ( Require local ).
So if someone just uses your Routers WAN IP address randomly, Apache will try to server a page from localhost, but when it see's that it is not allowed to accept connections from anywhere but localhost for the default site, it will just ignore that connection attempt and return an error. This stops randon access using just your ip address.


So your httpd-vhost.conf should look something like this :-


# Should be the first VHOST definition so that it is the default virtual host
# Also access rights should remain restricted to the local PC and the local network
# So that any random ip address attack will recieve an error code and not gain access
<VirtualHost *:80>
    DocumentRoot "c:/wamp/www"
    ServerName localhost
    ServerAlias localhost
    <Directory  "c:/wamp/www">
    	AllowOverride All
	Require local
	Require ip 192.168.188      <-- allow access from any ip on internal network
    </Directory>
</VirtualHost>

<VirtualHost *:80>
   DocumentRoot "D:/WEB DEV WORK/Client Projects/ETC/BLA BLA"
   ServerName host1234.ddns.net
   ServerAlias www.host1234.ddns.net

   <Directory "D:/WEB DEV WORK/Client Projects/ETC/BLA BLA">
      AllowOverride All
      Require local                  <-- set to this to keep people out
      #Require all granted       <-- uncomment this line when you want people to be allowed access
   </Directory>
</VirtualHost>


PS.

Its not a good idea to use folder names with spaces in them. It shoudl work, but it is safer not to have spaces in the directory and/or filenames.

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Allow Client To View Changes Without Live Server
Posted by: funkyfrank (---.226.133.43.179.swissinet.com)
Date: November 15, 2014 02:32PM

Riggs!

This fully did the trick for me! Excellent help!

I was struggling because of following issues:

1. I was editing files in C:\wamp\bin\apache\apache2.4.9\conf\original\extra
instead of in C:\wamp\bin\apache\apache2.4.9\conf\extra

2. I did not have Wamp running and opened port 80 on the router as well as set up the NOIP dyn dns. The firewall logs were telling me connections are coming in, though when testing the dyn dns host url in the browser it always gave me time out errors. This puzzled me. After some time of thinking about all this I figured that of course it is timing out because there is nothing to be served on port 80 with Wamp not running. Once I turned on Wamp with the correct VHs definitions the pages were served and also accessible from other IPs, including the smartphone on the local network.

3. I was super super bang bang happy when the first time the site got served on the smartphone through the dyn dns. Not only because I got the routing right, managed to open the port and set up the dyn dns but also because now I can fully test on smartphone and tablet without having to upload to a live server.

4. Riggs, thank you so much! Great info and I just love this kind of stuff, when things work out in IT I get seriously excited. Cannot wait for my first clients to give them a preview from a locally hosted site on a temporary domain. Fuck yeah! (Excuse my language, I am just super happy this works out!!)

BIG thank you to you Riggs!

p.s. How can I edit the forum posts so that I can include code, bold or quotes from other users please?

Very Best Regards
Frank

Version of Operating system? Windows 7 Ultimate 64bit
Version of Wamp Server installed? 2.5 32bit
Version of Apache you are running? 2.4.9
Version of MySQL you are running? 5.6.17
Version of PHP you are running? 5.5.12
What colour is your WampManager icon? Green
Host file localhost 127.0.0.1

New to WAMP?
Read this please: [forum.wampserver.com]

Options: ReplyQuote
Re: Allow Client To View Changes Without Live Server
Posted by: RiggsFolly (---.as43234.net)
Date: November 15, 2014 04:13PM

Frank,

These are the formatting codes I know about!

This is a bit cryptic as of course if I use the codes you wont see them, so here goes :-

You wrap these codes in square brackets, they normally have a opentag and a closetag, where the close tag starts with a slash, pretty much like standard html tags.



bold = b
italic = i
underline = u
code = code
quote = quote
url = url=some.url

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Allow Client To View Changes Without Live Server
Posted by: funkyfrank (---.226.133.43.179.swissinet.com)
Date: November 16, 2014 01:01PM

Thank you Riggs.

If you look below I guess bold, italic and underline are not working somehow, the rest seems fine.


Forum Formatting Codes

Make text bold:

[bold]Text you like to have bold.[/bold]


[italic]Text you like to have italic.[/italic ]


[underline]Text you like to have underlined.[/underline]


To quote use the same as underline and replace underline with quote.


Text or code you like to show raw without the forum software interfering with the code.


Post Link:

Open square bracket

then write url

then an equal sign =

then paste the url/link

then a close square bracket

then the text you like the link to have

then a open square bracket

then a forward slash

then write url again

and finally a close square bracket



And once more outside code tags so you can see the effect of the tags.


Forum Formatting Codes:


Make text bold:

[bold]Text you like to have bold.[/bold]


[italic]Text you like to have italic.[/italic]


[underline]Text you like to have underlined.[/underline]


Quote

This is a quote.


Text or code you like to show raw without the forum software interfering with the code.


..then the text you like the link to have..


If you can confirm bold, italic and underline do not work that would be good.

Again thank you.

Best
Frank

Version of Operating system? Windows 7 Ultimate 64bit
Version of Wamp Server installed? 2.5 32bit
Version of Apache you are running? 2.4.9
Version of MySQL you are running? 5.6.17
Version of PHP you are running? 5.5.12
What colour is your WampManager icon? Green
Host file localhost 127.0.0.1

New to WAMP?
Read this please: [forum.wampserver.com]



Edited 1 time(s). Last edit at 11/26/2014 12:47PM by funkyfrank.

Options: ReplyQuote
Re: Allow Client To View Changes Without Live Server
Posted by: RiggsFolly (---.as43234.net)
Date: November 16, 2014 01:40PM

bold = b in square brackets, terminated with /b in square brackets

italic = i in square brackets, terminated with /i in square brackets

underline = u in square brackets, terminated with /u in square brackets

---------------------------------------------------------------------------------------------
(Windows 10 Pro 64bit) (Wampserver 3.3.4 64bit) Aestan Tray Menu 3.2.5.4
<Apache versions MULTIPE> <PHP versions MULTIPLE> <MySQL Versions MULTIPLE>
<MariaDB versions MULTIPLE> <phpMyAdmin versions MULTIPLE> <MySQL Workbench 8.0.23>

Read The Manuals Apache -- MySQL -- PHP -- phpMyAdmin
Get your Apache/MySQL/mariaDB/PHP ADDONs here from the WAMPServer alternate Repo
-X-X-X- Backup your databases regularly Here is How dont regret it later! Yes even when developing -X-X-X-

Options: ReplyQuote
Re: Allow Client To View Changes Without Live Server
Posted by: funkyfrank (---.226.133.43.179.swissinet.com)
Date: November 16, 2014 02:32PM

If you like Ill make a new topic with details about this and you make it sticky or something?

Regards
Frank

Version of Operating system? Windows 7 Ultimate 64bit
Version of Wamp Server installed? 2.5 32bit
Version of Apache you are running? 2.4.9
Version of MySQL you are running? 5.6.17
Version of PHP you are running? 5.5.12
What colour is your WampManager icon? Green
Host file localhost 127.0.0.1

New to WAMP?
Read this please: [forum.wampserver.com]

Options: ReplyQuote


Sorry, only registered users may post in this forum.