how to remote access wampserver?
Posted by: huntersmith (112.168.224.---)
Date: August 04, 2014 10:53AM

Hi:

I'm new to the stuffs of web server, and just install the 32bit wampserver 2.5 in virtualbox in win 7 guest last night, the package info as follows:
Apache : 2.4.9
MySQL : 5.6.17
PHP : 5.5.12
PHPMyAdmin : 4.1.14
SqlBuddy : 1.3.3
XDebug : 2.2.5

I've followed the 2 topics of this forum, the sticky one of teaching virtual host setting, another is the 'wamp server online' whom ask for how to access wamp from out site world.

Well, after done all settings, I can access any of my 3 virtualhost site within the same localhost, but I can't access them from the host machine, it gave me a forbidden message:

Forbidden
You don't have permission to access /smile.net/ on this server.
Apache/2.4.9 (Win32) PHP/5.5.12 Server at 192.168.56.120 Port 80

I've setting the guest os with two network card, first one is NAT, the second is Host-Only; and
the host-only card I gave it static ip address: 192.168.56.120, mask: 255.255.255.0, and the IPv6 ip, I just leave it as blank.

I think the settings of virtualbox is fine, guessing the problem is still on the apache settings, but can't figure it out!

Can any body help me?

Thanks

Options: ReplyQuote
Re: how to remote access wampserver?
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: August 04, 2014 12:27PM

Hi Hunter,

Well it sounds like you are getting to the VM so it is probably a permission issue


In each Vhost you need to tell it that it can be accessed by the hosts ip or better still any ip on the subnet, so try this :-

<VirtualHost *:80>
    DocumentRoot "D:/wamp/www/wamphelpers"
    ServerName wamphelpers.dev
    ServerAlias www.wamphelpers.dev
    Options Indexes FollowSymLinks
    <Directory  "D:/wamp/www/wamphelpers">
    	AllowOverride All
	Require local

	Require ip 192.168.56

    </Directory>
</VirtualHost>

Because you have used only the first 3 of the 4 quartiles of the ip address it should allow any PC on your local network access to that VHOST.

---------------------------------------------------------------------------------------------
(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: how to remote access wampserver?
Posted by: huntersmith (112.168.224.---)
Date: August 04, 2014 01:37PM

Hi, thank you for help!

Now I can access the first default virtualhost and the second one from host machine.
But the second vhost can be accessed as a sub-directory only (http://192.168.56.120/noble/), as it's stored in c:/etc/wamp/www/noble. But the third vhost, I don't know how to find it from the url! It's stored in C:/www/smile-net/.
Also the Aliases :
phpmyadmin
phpsysinfo
sqlbuddy
webgrind

They are forbidened too.

In the guest OS, the second vhost can be accessed as [noble.com], or localhost/noble/, and
the third one can be accessed as [smile.net]



next is part of my modified httpd-vhost.conf

<VirtualHost *:80>
ServerAdmin webmaster@localhost
DocumentRoot "c:/etc/wamp/www"
ServerName localhost
ServerAlias localhost
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
<Directory "c:/etc/wamp/www">
AllowOverride All
Require local
Require ip 192.168.56
</Directory>
</VirtualHost>

<VirtualHost *:80>
ServerAdmin webmaster@noble.com
DocumentRoot "c:/etc/wamp/www/noble"
ServerName noble.com
ServerAlias www.noble.com
ErrorLog "logs/noble-error.log"
CustomLog "logs/noble-access.log" common
<Directory "c:/etc/wamp/www/noble">
AllowOverride All
Require local
#Require all granted
Require ip 192.168.56
</Directory>
</VirtualHost>


<VirtualHost *:80>
ServerAdmin webmaster@smile.net
DocumentRoot C:/www/smile-net
ServerName smile.net
ServerAlias www.smile.net

<Directory "c:/www/smile-net">
Options FollowSymlinks
AllowOverride All
#Require all granted
Require local
Require ip 192.168.56
</Directory>

php_flag display_errors On
php_flag log_errors On
# php_value max_upload_size 40M
php_value max_execution_time 120
php_value error_log "c:/www/smile-net/logs/error.log"
</VirtualHost>

I had modified only 2 conf files after the installation, the 'httpd.conf' that uncomented the vhost line, and the above parts in 'httpd-vhost.conf'.

Hope I have offered enough infos.

thanks

Options: ReplyQuote
Re: how to remote access wampserver?
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: August 04, 2014 02:12PM

Ok to get Virtual hosts to work correctly you need to call then with the ServerName or the ServerAlias so apache knows where to route the connection.


So the simplest way is to do this on the HOST OS

Add these to the \windows\system32\drivers\etc\hosts file


192.168.56.120 localhost smile.net noble.com

If your guest OS has an IPV6 address you would also add that in the same way.

Then restart the dnscache (service called DNS Client)


This will tell Windows, and therefore the browsers on the PC hosting the HOSTS file where these domains live.

So now from the browser you can use the addresses

'http://smile.net' and 'http://noble.com' and 'http://localhost' ( without the single quotes of course )


Its a bit dangerous using the actual .com and .net tld extensions as once the HOSTS file is amended this PC wont b able to get to a LIVE external site with those names. I normally change the names to use a .dev extension like

'smile.dev' and 'noble.dev'

so I can still visit the live sites as well as my development versions. If you are intending to host these site LIVE on WampServer this of course does not apply.

---------------------------------------------------------------------------------------------
(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: how to remote access wampserver?
Posted by: huntersmith (112.168.224.---)
Date: August 04, 2014 03:25PM

Thank you for kindness reply, RiggsFolly.

as your suggestion, I've change my sites' names, and,
I already have done the editing of 'hosts' file inside the virtualbox guest os, the server:

127.0.0.1 localhost
127.0.0.1 noble.dev
127.0.0.1 smile.box
127.0.0.1 flower.dev

192.168.56.120 noble.dev
192.168.56.120 smile.box
192.168.56.120 flower.dev


Two questions left:
First: should I have do the same step on my host os too? Confused a bit..

Second: how to remote access the vhost sites not in the wampserver default directory?
Currently I can access the vhosts freely inside the localhost, no problem on this.

To access them out side of the virtualbox, the sites stored in 'c:/etc/wamp/www/', I can access it as a sub-directory, anyway, it worked,
but sites stored in 'c:/www/', how can I find them out side the server, from the virtualbox host machine, the client machine?

Ooops! I'm really a beginner, asking such newbie questions ^^;

Thanks again.

Options: ReplyQuote
Re: how to remote access wampserver?
Posted by: RiggsFolly (---.dynamic.dsl.as9105.com)
Date: August 04, 2014 03:58PM

First: should I have to do the same step on my host os too? Confused a bit..

Yes, that was where I meant for you to do the change to the HOSTS file. I assume you are running the sites on the Guest and testing i.e. browsing from the host OS. So that needs to know where to go to find your sites more than the guest OS.


Second: how to remote access the vhost sites not in the wampserver default directory?
Currently I can access the vhosts freely inside the localhost, no problem on this.


Not such a noob question, and not a simple answer.



You need to lookup Port Forwarding ( www.portforwarding.com will help with that ) so you can port forward your router.

But (on guest) you change the access from [Require ip 192.168.56] to [Require all granted] that allows apache to serve requests from any ip. Only for the sites you want to be visible from the internet.

Make sure the guest OS has a staic IP.

Port forward your router's port 80 to port 80 on the ip address of the guest OS. This opens port 80 on your router and forwards any access on port 80 to the ip address of the guest OS which is running Apache. Apache should then respond.


Do you own the registration of the site names. If so you then get the company you bought them from to forward the domain to your routers IP.

If you live n a country where you get a different IP every time you boot your router you also need to look up DYNAMIC DNS ( DYNDNS or NOIP )
They will give you a bit of software to run on the guest OS that updates their servers with your currebt ip address. They can also issue a domain name if you have not bought one but htey look a little odd eg mysite.dyndns.org for example.

Anyway hope that helps although it probably just adds more to your TODO list

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