The Homepage, Your Projects Menu
Posted by: Fiction03 (---.columbus.res.rr.com)
Date: June 29, 2014 05:59AM

Riggs,

I stumbled across all of this information as I was looking up how to enable access to my apache server on my LAN. I must say, i'm a novice apache/php user, and I've spent the better part of my evening trying to wrap my head around all of this. I believe I understand the purpose and the benefit of using virtual hosts going forward for local development, and have set it up to work for the wordpress I'm currently working on. I was hoping to ask a few questions regarding this situation as a whole from the perspective of someone this change is exactly intended for.

Version of Operating system? Win 7 64bit
Version of Wamp Server installed? 2.5
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
Green Icon

Up until now, I have been using 'localhost/mywebsite' to access my wordpress. After enabling virtual hosts, I'm able to access my wordpress using 'http://mywebsite/'. I've also enabled the virtual hosts menu in the wampmanager icon, and it lists my host 'mywebsite' correctly.

I plan to move this wordpress to another server that is hosted on an internal network, and I'm trying understand what it is I must do now to fix any dragons that might fire up down the road. For example, after landing on my home page at 'http://mywebsite/', I expected to click on a link and get taken to 'http://mywebsite/newapage', except I'm redirected to localhost/mywebsite/newpage. Is this intended? Or is this part of the problem I'm going to experience down the road? If so, what are my options as far as correcting this?

My second is issue is actually being able to connect to my apache server from inside my subnet to allow some close coworkers to demo this site before it gets moved to the company wide network. I've tried fiddling with my virtual host to allow specific IPs on my subnet (10.10.50.xxx), as well as the entire subnet (10.10.50.0/24), but when I try to access my website from another machine on the same network, I get a 403 forbidden error.

My current virtualhost for this website is as follows
<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/mywebsite"
    ServerName  www.mywebsite.com
    ServerAlias mywebsite.com
    <Directory  "C:/wamp/www/mywebsite">
        AllowOverride All
	Require all granted

	
    </Directory>
</VirtualHost>

I have added the correct address to my hosts file on the server machine
(127.0.0.1 www.mywebsite.com
::1 www.mywebsite.com)

I am using the address 10.10.50.xxx/mywebsite to connect from the client machine that gets the forbidden error.

Any time/help anyone can offer is extremely appreciated! I must get some sleep, my head feels like it's going to split open soon.

edit: So after a nice refreshing sleep I've been reading more of the apache documentation on virtual hosts, and I've since removed some redundant pieces.

I've also begun to feel more and more as if I need to create a fresh install of wordpress using a new virtualhost and rebuild my wordpress to eliminate any issues that could happen when moving this to a different server.

I'm also still getting a 403 error when trying to connect to my apache machine from a client on the network.

edit2: So I've gotten past the 403 forbidden error. I believe it was an issue with my listen setting in httpd that I had changed to 0.0.0.0:80, after switching that back to just 80 it appears to be allowing me to connect from another machine on my network. Unfortunately I'm running into the same issue as this thread [forum.wampserver.com] . It's interesting because nothing works other than my homepage, as soon as I direct somewhere else, I'm pointing to a localhost address that doesn't work on my client obviously. This is where my rookieness hits hard I think, because I believe I will have to start from scratch using a new virtual host installation of wordpress. Any suggestions would be great.

edit3: It works! After updating the url's of my wordpress using this guide [codex.wordpress.org], I'm able to navigate the site fully from a client machine on my network. Hopefully all of my rambling here will help anyone else in this situation down the road.

I'd also like to add that I made a change to my virtual host definition to allow people to connect to my wordpress using just my ip address rather than have to add a hosts definition in etc/hosts for each machine.

<VirtualHost myinternalserverip:80>
    DocumentRoot "C:/wamp/www/mywebsite"
    ServerName  www.mywebsite.com

    <Directory  "C:/wamp/www/mywebsite">
        AllowOverride All
	Require all granted
	
    </Directory>
</VirtualHost>



Edited 11 time(s). Last edit at 10/02/2014 04:58PM by Otomatic.

Options: ReplyQuote
Re: WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts
Posted by: andrzej.kmicic (---.cdma.centertel.pl)
Date: July 14, 2014 07:23AM

For me the writing was bad :

<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/mywebsite"
    ServerName  www.mywebsite.com
    ServerAlias mywebsite.com
    <Directory  "C:/wamp/www/mywebsite">
        AllowOverride All
	Require all granted

	
    </Directory>
</VirtualHost>

this is good::



<VirtualHost *:80>
    DocumentRoot "C:/wamp/www/mywebsite"
    ServerName  www.mywebsite.com
    ServerAlias mywebsite.com
</VirtualHost>


    <Directory  "C:/wamp/www/mywebsite">
        AllowOverride All
	Require all granted	
    </Directory>



Options: ReplyQuote
Re: WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 14, 2014 11:47AM

But the the instructions in the <Directory>... </Directory> are related to the Virtual Host and so should go inside the <VirtualHost> wrapper.

---------------------------------------------------------------------------------------------
(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: WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts
Posted by: andrzej.kmicic (79.162.234.---)
Date: July 14, 2014 09:21PM

Yes you are right I just checked. But once (very recently) so I don't have to be, because I do not work?. Now it can be wrapped inside,

thank you

ps: But it also works not wrapped !

Options: ReplyQuote
Re: WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts
Posted by: Otomatic (Moderator)
Date: July 15, 2014 09:33AM

Hi,

> ps: But it also works not wrapped !

Yes, but in different ways and with different consequences.

Inside <VirtualHost...> structure, permissions or access restrictions only apply once connected to this VirtualHost.
Outside <VirtualHost...> structure, permissions or access restrictions will still apply, even if not connected to the VirtualHost.

---------------------------------------------------------------
Documentation Apache - Documentation PHP - Documentation MySQL - Wampserver install files & addons

Options: ReplyQuote
Re: WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts
Posted by: tenesan (41.58.130.---)
Date: July 16, 2014 03:26PM

Hello,

I too am having trouble accessing my virtual host from another system on the same network. Using "IP/serverName" on another machine gives a "403 Forbidden" error, while using "IP/serverName" on my machine returns a "404 Not Found".

Your comment mentions changing your listen setting in httpd.conf, I tried that but couldn't get wampserver to turn green afterwards.

Any help would be appreciated. Here are my settings (sorry, dunno how to post code here).

Listen 0.0.0.0:80
Listen [::0]:80

<VirtualHost *:80>
DocumentRoot "C:/dev/wamp/www/wp_test"
ServerName wptest.local
<Directory "C:/dev/wamp/www/wp_test">
AllowOverride All
Require all granted
</Directory>
</VirtualHost>

Options: ReplyQuote
Re: WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 16, 2014 04:02PM

If you want to access a Virtual Hosted site from another machine you will need to let the other machine know where to find the domain name.

This is basically what DSN Servers out there on the web does for us all without most of us knowing!

So there are a number of ways of doing this

1. Get a DNS Server, install it, and configure all your machines to use it before any other DNS Server.
This is a bit complicated, so I am not suggesting this as a solution.



2. On the other machine edit the HOSTS file and create an entry like this
Lets assume you have installed WAMPServer on a machine with the STATIC ip address of 192.168.0.10

So ON THE OTHER MACHINE edit C:\windows\system32\drivers\etc\hosts
Add this to the hosts file

192.168.0.10  wptest.local

Then run this from a command window launched with 'Run as Administrator'

net stop dnscache
net start dnscache


Now you can use the correct domain name in the OTHER machines browser and it will know where it is as you have told windows to seed the DNS cache with this address. Once the request gets to your WAMPServers Apache it will know the domain name ( as that what you entered in the browser ) so it will find the correct virtual hosted site.

---------------------------------------------------------------------------------------------
(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: WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts
Posted by: tenesan (41.58.130.---)
Date: July 16, 2014 07:13PM

Hello @RiggsFolly,

Thanks for taking time out to chip in.

I am trying to access the virtual hosts from a mobile device on the LAN network, so nothing can be done from the remote end.

Is there anything that can be done on the computer running the the server to allow other machines/ devices access virtual hosts remotely without doing anything on the remote end?

Apart from the DNS Server option, which sounds absolutely scary.

Would appreciate any help on this.

Thanks a lot again.

Options: ReplyQuote
Re: WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 17, 2014 01:16AM

Well there is a couple of things I have done in this situation:

1. Make the site you want to access the first one defined in the httpd-vhost.conf file.
Apache will default to the first entry in thsi file if it cannot find the domain used in the browser.
So use the ip address and you will run the first defined site.


2. I use FIDDLER, its a http degug tool. Any serious web developer shoudl get it.

But it has the ability to also be a REVERSE PROXY. see doc [docs.telerik.com]

This lets you browse to lets say your WAMPServer PC on 192.168.0.10:8000 on your phone, WITHOUT HAVING TO CHANGE YOUR APACHE CONFIG.
You then write a rule in Fiddler that says if you see connection on to 192.168.0.10:8000 change the host name to mydomain.dev

This get you into the correct place with the correct domain name without having to use the correct domain name on the handset, but only a port number, which the handset browser will allow you to do.
So you browse to 192.168.0.10:8000 and get to mydomain.dev




For example here is one of my fiddler rules I use to get to a site I defined as project1.wap, So project1.wap was the ServerName in a VHOST definition

static function OnBeforeRequest(oSession: Session)
	{

		if ( oSession.host.ToLower() == "192.168.2.10:8000" ) {
			oSession.host = "project1.wap";





I hope this helps.

Option 2 sounds a bit complex but once you do it for the first site you will use it all the time for later projects

---------------------------------------------------------------------------------------------
(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: WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts
Posted by: tenesan (41.58.130.---)
Date: July 17, 2014 02:30PM

Hello,

Thanks for the comprehensive reply.

This is the first I have heard of FIDDLER, with my work focused primarily on design and front-end dev, I am not surprised, it seems quite technical. I have installed it though, intend to play around with it and see how it might be useful.

Back to the issue, I tried option 1 - obviously, and immediately ran into issues with urls still pointing to my virtual host instead. *Note* This is a WordPress site.

Would I be correct in assuming this will be the same with option 2?

Thanks again.

Options: ReplyQuote
Re: WAMPServer 2.5 The Homepage, Your Projects Menu and the need for Virtual Hosts
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: July 17, 2014 02:56PM

WordPress likes to be installed on the domain that will be used to access it as it stores some info about its domain in its database.

Look at the WP site for what needs chnaging when you change the domain, that should help identify and educate.

---------------------------------------------------------------------------------------------
(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


Sorry, only registered users may post in this forum.