External access web page with VirtualHosts and Wampserver - virtualhost

I am a newbie in wampserver.
I installed it and I can acesss web pages with localhost port 8000 without problems. Yes, I changed default port to 8000 and all works well with localhost.
Now, I created a simple project web page and I need external access. Here is my settings:
But I get the next error when I try to acesss remotely:
Forbidden
You don't have permission to access / on this server.
Apache/2.4.23 (Win64) PHP/5.6.25 Server at agenda.myvnc.com Port 8000
//agenda.myvnc.com is my elastic IP host server
My sample project:
Folders:
c:\wamp64\www
...........cloudappoint.myvnc.com(subfolder in www)
File in cloudappoint.myvnc.com folder: index.php
NOIP DNS:
- Host:cloudappoint.myvnc.com
- Target IP:XXX.XXX.XXX:8000(My host is located at amazon ec2 with elastic ip- XXXX.XXX.XXX)
- type:URL
WampServer VirtualHosts:
<VirtualHost *:8000>
ServerName cloudappoint.myvnc.com
DocumentRoot c:/wamp64/www/cloudappoint.myvnc.com
ErrorLog "logs/agenda-error.log"
CustomLog "logs/agenda-access.log" common
<Directory "c:/wamp64/www/cloudappoint.myvnc.com">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
EDITED: Here is my complete Virtual hosts file:
<VirtualHost *:8000>
ServerName localhost
DocumentRoot c:/wamp64/www
<Directory "c:/wamp64/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:8000>
ServerName cloudappoint
ServerAlias cloudappoint.myvnc.com
DocumentRoot c:/wamp64/www/webagenda
ErrorLog "logs/agenda-error.log"
CustomLog "logs/agenda-access.log" common
<Directory "c:/wamp64/www/webagenda/">
Options +Indexes +FollowSymLinks +MultiViews
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I am unable to acesss remotely cloudappoint.myvnc.com, but if I move
<Directory "c:/wamp64/www/webagenda/">
Options +Indexes +FollowSymLinks +MultiViews
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
out from VirtualHost, all works well. Then, I guess 3.06 has broken Directory into Virtual Hosts.

Related

How can I keep a global ServerName in apache working?

The Apache documentation is a bit unclear on the vhost configuration. Where I normally use wampserver, I discovered a discrepancy with XAMPP. Consider the fairly standard httpd.conf in the XAMPP distribution containing among other things:
ServerName localhost:80
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
</Directory>
And a empty httpd-vhosts.conf file. Everything works as advertised and the content of the xamp/htdocs folder is used (and redirects to /htdocs/dashboard)
As soon as a section is added to file httpd-vhosts.conf, for instance
<VirtualHost *:80>
ServerName customer01.localhost
DocumentRoot "D:/Customers/Customer01/httpdocs"
<Directory "D:/Customers/Customer01/httpdocs">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
And the proper amendments are made to .../etc/hosts. http://localhost stops working as it now redirects to D:/Customers/Customer01/httpdocs ignoring the ServerName setting in httpd.conf.
Is this by design?
If, however, in addition to the ServerName setting in httpd.conf the following is added to httpd-vhosts.conf:
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "C:/xampp/htdocs"
<Directory "C:/xampp/htdocs/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local
</Directory>
</VirtualHost>
things are fine again.
Why is the extra vhost needed as the global ServerName is already set in httpd.conf? Is this something the ApacheFriends should add to vhost by default?

I can't access my WAMP 3.2.3 project from other devices

I have developed a website with a complete different virtual host in WAMP v 3.2.3 it's running well on my local machine(localhost) but the problem lies with it's access over the LAN.I have changed its apache httpd-vhosts.conf file from
# 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
</Directory>
</VirtualHost>
#
<VirtualHost *:80> //My required Virtual Host
ServerName test
DocumentRoot "c:/wamp64/www/project1/test/sites/">"
<Directory "c:/wamp64/www/project1/test/sites/">">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require Local
</Directory>
</VirtualHost>
to:
# 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
</Directory>
</VirtualHost>
#
<VirtualHost *:80> //My required Virtual Host
ServerName test
DocumentRoot "c:/wamp64/www/project1/test/sites/">
<Directory "c:/wamp64/www/project1/test/sites/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted // <--change(Local to all granted)
</Directory>
</VirtualHost>
and allowed incoming inbound connection from port 80
Still the problem persists and I cannot access my project from any other device.
It shows:
Forbidden
You don't have permission to access this resource
Apache/2.4.46 (Win64)PHP/7.3.21 Server at 192.168.43.*
Where'the problem?
Please help.
you don't need to hide your local IPv4 address 192.168.43.*, there are millions of devices around the world with same IPv4 address as you, people outside of your local network can not communicate with your local IP address just by knowing your IPv4 address, it is not possible.
You appear to have multiple virtual hosts set up for port 80. You only need one for local hosting.
Make sure that the firewall on your server computer is configured to let apache through.
Put whatever files you want to server inside the 'www' folder on your server computer.
Use the below config settings and restart apache so that the new config is loaded.
Open a web browser on any device that is connected to the same local network as your server computer i.e. mobile phone connected by wifi to the same router as your server computer.
Type in the server computer IPv4 address into the browser of your mobile phone, done...
<VirtualHost *:80>
DocumentRoot ${INSTALL_DIR}/www
<Directory ${INSTALL_DIR}/www>
Require all granted
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
</Directory>
</VirtualHost>
# 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
</Directory>
</VirtualHost>
To
# 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
Require all granted
</Directory>
</VirtualHost>
Next step: Open wamp file see this image
find this section to changes see this image
Require all denied
To
Require all granted
Save and close. Restart all service your wampserver
then paste your ipaddress in browser url see the result

WAMP Server will not allow access to website using "www"

I cannot access my website using "www" before domain name but I can if I don't use the "www". I would like to have both accessible.
I am very familiar using Apache2 Server on Linux but it's not often I have to use it alongside WAMP. I have done plenty of messing around in the config files and have tried a few different methods but nothing seems to be working.
Here is the httpd-vhosts.conf file:
# Virtual Hosts
<VirtualHost *:80>
ServerName localhost
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www"
<Directory "${INSTALL_DIR}/www/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName wherehousemke.com
DocumentRoot "c:/wamp64/www/wherehousemke"
<Directory "c:/wamp64/www/wherehousemke/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
Require all granted
</Directory>
</VirtualHost>
The website that I am trying to get this to work for is http://wherehousemke.com. That URL is working but if you add "www" in there It will NOT work.
you need to add a DNS record that redirects from your TLD to the www subdomain https://www.digitalocean.com/community/questions/using-cname-for-www-redirection

Accessing Wamp 3.1.0 from other devices

I have Wamp Server 3.1.0 installed on my Windows computer.
I am trying to access my sites from other devices, connected are connected on the same network.
I have searched online. And I have followed tutorials, but nothing matches what I need. The closest I got was: How to enable local network users to access my WAMP sites?
My httpd-vhosts.conf looks like this:
# 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 granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName laravel.dev
DocumentRoot "c:/wamp/projects/forum/public"
<Directory "c:/wamp/projects/forum/public/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName test.dev
DocumentRoot "c:/wamp/projects/test/public"
<Directory "c:/wamp/projects/test/public/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require local granted
</Directory>
</VirtualHost>
My expectation at this point is I can go onto another device and access my Wamp Server 3.1.0 and my individual projects.
Unfortunately I'm hit with an Error 500 saying:
Forbiddon
You do not have permission to access / on this server.
_______________________________________________________________
Apache/2.4.27 (Win64) PHP/7.1.9 Server at 192.168.1.21 Port 80
I have double checked my ipconfig and IPv4 Address matches the IP in the Error 500 code: 192.168.1.21
I did notice that the Apache version and PHP version match the versions I am using. So I know I'm accessing the server. Just not sure of the Error 500 code.
I have tried accessing my projects from these URLs:
http://192.168.1.21
http://192.168.1.21:80
http://laravel.dev/
http://test.dev/
http://localhost/
And none of them work.
Thanks in advance.
Change Require local granted to Require all granted, if not solved, Try to edit httpd-vhosts.conf file like this:
# 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
Require ip 192.168.1
</Directory>
</VirtualHost>
try access your ip computer from other device, for example your computer ip is 192.168.1.4, if you can access this ip, then create your virtual host.
if you can not access that ip, try fixing it so ip can be accessed. then create a virtual hosts.

Apache Symfony Vitrual Host

I clone project in /home/ivan/host/name/web and create virtual host. a2ensite and reload and restart server.
<VirtualHost *:80>
ServerName name.local
DocumentRoot /home/ivan/host/name/web
DirectoryIndex app.php
ErrorLog /var/log/apache2/name-error.log
CustomLog /var/log/apache2/name-access.log combined
<Directory "/home/ivan/host/name/web">
AllowOverride All
Allow from All
</Directory>
and hosts
127.0.0.1 name.local
but have
Forbidden
You don't have permission to access / on this server.
I doing chmod 777 -R host/ but still have error
what I'am doing wrong ?
SOLVED
<VirtualHost *:80>
ServerName aog.local
DocumentRoot /home/ivan/host/name/web
DirectoryIndex app.php
ErrorLog /var/log/apache2/name-error.log
CustomLog /var/log/apache2/name-access.log combined
<Directory "/home/ivan/host/name/web">
AllowOverride All
Require all granted
Allow from All
</Directory>
Look like you are using apache 2.4,
add directive Require all granted as shown below:
<Directory /home/ivan/host/name/web>
AllowOverride All
Options +FollowSymlinks
Require all granted
</Directory>