Apache virtualhost on another port - apache

I have mamy virtualhosts on Apache server (Arch Linux) and they are on hosts like 127.0.0.2, 127.0.0.10 and so on. One of them i want to make available from local network, so I could use address like 192.168.1.100 to get resources from that server, but I don't want to use default port. Now I have such configuration on /etc/httpd/conf/extra/httpd-vhosts.conf
<VirtualHost 127.0.0.1:8324>
DocumentRoot "/home/dominik/Dropbox/dev/SOMEAPP/root"
<Directory /home/dominik/Dropbox/dev/SOMEAPP/root>
DirectoryIndex index.php
Options +Indexes +FollowSymLinks +MultiViews +Includes
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
It works perfect on local machine using localhost or 127.0.0.1, but when using lan address on port 8324, i get default apache site (like I make request on port 80)
curl 127.0.0.1:8324
HTML from SOMEAPP is returned
curl 192.168.1.100:8324
Default Apache index is returned
My /etc/hosts:
#
# /etc/hosts: static lookup table for host names
#
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost
#::1 localhost.localdomain localhost
127.0.0.2 xx.tu xx.tu
# 127.0.0.3 xxxxx.tu xxxxx.tu
127.0.0.4 xxxxxxxx.tu xxxxxxxx.tu
127.0.0.5 xxxxxxxxxxx.tu xxxxxxxxxxx.tu
127.0.0.6 xxxxx.tu xxxxx.tu
127.0.0.10 xxxxxxx xxxxxxxx
I'd be glad if someone have some idea. Thanks.

Probably a SuperUser question, anyway:
<VirtualHost 192.168.1.100:8324>
DocumentRoot "/home/dominik/Dropbox/dev/SOMEAPP/root"
<Directory /home/dominik/Dropbox/dev/SOMEAPP/root>
DirectoryIndex index.php
Options +Indexes +FollowSymLinks +MultiViews +Includes
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>
</VirtualHost>
p.s. you might want to modify your httpd configuration to avoid receiving the default apache index when you call the apache server with an Ip which doesn't correspond to any defined virtualhost

Related

WAMP server not able to be viewed on LAN

I've tried changing things in the vhost config and the httpd config but it never is able to be viewed on the same wifi network.
In vhosts I changed it to
# Virtual Hosts
#
<VirtualHost *:80>
ServerName Test
ServerAlias localhost
DocumentRoot "${INSTALL_DIR}/www/ConklinServer"
<Directory "${INSTALL_DIR}/www/ConklinServer">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
But it doesnt work, i also changed the listen ip in httpd config and that doesnt work either. Help!

Cant access WAMP over LAN

I have read many posts here and many tutorials as well.. and for some reason.. I just cant get access to my WAMP install/pages/content from other machines on the network?
WAMP 2.4 (still) :)
Here is what I have tried so far:
WAMP install machine IP: 192.168.1.121
I have enabled/disbaled Windows Firewall on the WAMP install machine (completely for testing)
I have created a an INBOUND rule allowing (TCP, on PORT 80, private option selected only, also tried to check public)
Apache httpd.config:
Listen 192.168.1.121:80
Listen 80
Then a bit below:
Order Deny,Allow
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
Allow from 192.168.1.101
Allow from all
Complete:
<Directory "c:/wamp/www">
Options Indexes FollowSymLinks
AllowOverride All
# onlineoffline tag - don't remove
Order Deny,Allow
# Deny from all
Allow from 127.0.0.1
Allow from ::1
Allow from localhost
Allow from 192.168.1.101
Allow from all
</Directory>
I my Apache httpd-vhosts.conf file I have (outside of some other default and test entries) the following:
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot "c:/wamp/www"
ServerName localhost
<Directory "c:/wamp/www/">
Options +Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/localhost-error.log"
CustomLog "logs/localhost-access.log" common
</VirtualHost>
<VirtualHost *:80>
ServerAdmin webmaster#BarBot.com
DocumentRoot "c:/wamp/www/barbot/"
ServerName BarBot
ErrorLog "logs/BarBot-error.log"
CustomLog "logs/BarBot-access.log" common
<directory "c:/wamp/www/barbot/">
Options +Indexes +FollowSymLinks +MultiViews
Require all granted
#Deny from all
#AllowOverride All
#Allow from 127.0.0.1
#Require all granted
#Require ip 192.168.1
#Require ip 192.168.1:80
</directory>
</VirtualHost>
I grabbed a netbook I had laying around.. plugged it into my network..
loaded up browser and went to:
192.168.1.121
as well as
192.168.1.121:80
192.168.1.121:80/barbot
I will either get:
timed out message on browser..
or more recently
Not found: The requested URL /barbot was not found..etc..etc..
At this point I am lost.. I dont even have a direction to pursue or test with?
I have also tried to toggle putting WAMP online/offline.. neither state seemed to make a difference?
What am I missing here? What things can I test out? And is there a way to check on things? Logs? Errors? Something that will give me direction? Or help get direction at least?)
Update:
Second PC -
IP: 192.168.1.101
I can PING the 192.168.1.121 machine just fine.. never misses a packet.
Final State:
Something is 'working', but must be configured somehow/somewhere?
When I attempt to open: 192.168.1.121:80/barbot (WAMP machine) I get a NOT FOUND (404) page...
If I try to go to say... 192.168.1.121:8080 (I get Unable to Connect page/message)..

The requested URL / was not found on this server. in Wamp 3.1.0

I know there are similar questions about this but non of them resolve my problem.
I already used virtual host and it was running before until this morning this error occurred when I tried to access this link http://www.notification.test/
I have this kind of error.
Not Found
The requested URL / was not found on this server.
Apache/2.4.27 (Win64) Server at www.notification.test Port 80
I have this in my hosts 127.0.0.1 www.notification.test
and this is my setup in C:\wamp64\bin\apache\apache2.4.27\conf\extra
<VirtualHost *:80>
DocumentRoot C:/wamp64/www/notification/public
ServerName www.notification.test
<Directory C:/wamp64/www/notification/public>
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I just add the directory as what suggested from another post but didn't work.
My Wamp version is 3.1.0 running in 64 bit windows7 OS and the Apache is 2.4.47.
Need some help guys and thank you.
Basically its just a missing / see the <Directory..... parameter.
<VirtualHost *:80>
ServerName notification.test
ServerAlias www.notification.test
DocumentRoot "C:/wamp64/www/notification/public"
<Directory "C:/wamp64/www/notification/public/">
Options +Indexes +Includes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
Also you HOSTS file should look like this
127.0.0.1 localhost
127.0.0.1 notification.test
::1 localhost
::1 notification.test
Note:
Require all granted is a bit unnecessary if you are just using other PC's in your own network. Instead use Require ip 192.168.0 for example, to allow any ip in your local network access but nothing outside your own network.

WampServer: 403 Forbidden

All of a sudden my local WampServer vhosts are not working.
I've added a new vhost to vhosts.conf and hosts.
When I load that vhost in a web browser, I receive 403 Forbidden.
In vhosts.conf, I have:
<VirtualHost *:80>
ServerName example.com.au
ServerAlias example.com.au
DocumentRoot "D:\Dropbox\WAMP\WWW\example.com.au"
<Directory "D:\Dropbox\WAMP\WWW\example.com.au">
Options Indexes FollowSymLinks MultiViews
Require all granted
</Directory>
</VirtualHost>
In httpd.conf I have:
Listen 10.0.0.199:80 ::1
Listen [::0]:80
<Directory />
AllowOverride none
Require all denied
</Directory>
where 10.0.0.199 is my PC's IP.
WampServer is online.
WampServer 3.0.6
Apache 2.4.23
Help appreciated.
I changed
<Directory />
AllowOverride none
Require all denied
</Directory>
to
<Directory />
AllowOverride none
Require all granted
</Directory>
in httpd.conf, and that resolved the 403 error.
The default config in httpd.conf has all the Listen parameters you need
Listen 0.0.0.0:80
Listen [::0]:80
This says listen on port 80 of whatever this PC's ip address is for both IPV4 and IPV6 address ranges, and is all you need.
This section of httpd.conf should also be left as you found it. This sets up the basic denial of all rights to all folders on the drive where you installed WAMPServer(Apache) and should do exactly that. Change it back to this
<Directory />
AllowOverride none
Require all denied
</Directory>
This is for your security. It say nobody is allowed access to the root of this driver and therefore no access to anything below the root. Once this is set you are then supposed to open up access to ONLY what Apache actually need access to. That is what you do in your httpd-vhosts.conf file for only the folders that site requires access too.
If you are hacked, then a hacker can only access those folder given access and NOT YOUR WHOLE DRIVE.
Your Virtual Host definition in httpd-vhosts.conf shoudl look like this
<VirtualHost *:80>
ServerName example.com.au
ServerAlias www.example.com.au
DocumentRoot D:/Dropbox/WAMP/WWW/example.com.au
<Directory "D:/Dropbox/WAMP/WWW/example.com.au/">
Options Indexes FollowSymLinks MultiViews
AllowOverride All
## Dangerous unless you really mean to
## allow the universe into your server
## I would use one of the other options and comment this one out
Require all granted
# If access from this PC only then us
# i.e. you are a standalone developer
# uncomment this
#Require local
#If access from your local network is required
# i.e. you are working with other devs within your local network
# uncomment this
#Require ip 10.0.0
</Directory>
</VirtualHost>
Note the use of Unix forward slashes and the <Directory.... tag needs a trailing slash
Then check your HOSTS file it should be like this
127.0.0.1 localhost
::1 localhost
127.0.0.1 example.com.au
::1 example.com.au

Wamp is Green and Online but still 403 error

C:\wamp\bin\apache\apache2.4.9:
<VirtualHost *:80>
DocumentRoot C:\wamp\wwww\sk\public
ServerName sk.localhost
SetEnv APPLICATION_ENV "development"
<Directory "C:\wamp\wwww\sk\public">
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
Require local
Allow from localhost ::1 127.0.0.1
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:\wamp\wwww\sk\public
ServerName sk.localhost
SetEnv APPLICATION_ENV "development"
<Directory "C:\wamp\wwww\sk\public">
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AllowOverride All
Order allow,deny
Allow from all
Require local
Allow from localhost ::1 127.0.0.1
</Directory>
</VirtualHost>
Hosts file:
# localhost name resolution is handled within DNS itself.
# 127.0.0.1 localhost
# ::1 localhost
127.0.0.1 localhost
127.0.0.1 sk.localhost
When I try to access localhost or sk.localhost it gives me 403 error (Wamp is green and Online. Anyone can help please? I don`t know what am I doing wrong here. I tried several methods from Internet but with no luck. Any help would be much appreciated. Best regards, Bogdan.
PHPMyadmin is working.
This is probably because you are using 2 different versions of the access security syntax and Apache is getting confused.
Change your Virtual Host definitions as below to use just the Apache 2.4 syntax and not the Apache 2.2 ones.
Also you should create a VH for localhost as well, as when you implement Virtual Hosts, Apache ignores the definition of localhost in the httpd.conf file.
# Should be the first VHOST definition so that it is the default virtual host
# Also access rights should remain restricted to the local PC
# So that any random ip address attack will recieve an error code and not gain access
<VirtualHost *:80>
DocumentRoot "c:/wamp/www"
ServerName localhost
<Directory "c:/wamp/www">
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:\wamp\wwww\sk\public
ServerName sk.localhost
SetEnv APPLICATION_ENV "development"
<Directory "C:\wamp\wwww\sk\public">
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AllowOverride All
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot C:\wamp\wwww\sk\public
ServerName sk.localhost
SetEnv APPLICATION_ENV "development"
<Directory "C:\wamp\wwww\sk\public">
Options Indexes FollowSymLinks MultiViews
DirectoryIndex index.php
AllowOverride All
Require local
</Directory>
</VirtualHost>
The Require local tells Apache to only allow access to a VH domain if the client is on the PC running WampServer(Apache).
If you actually want to allow access from say another PC on your local network, you can add a line like this to the domain you want to access
Require local
Require ip 192.168.1
Or if you want to allow access from anwhere replace those lines with
Require all granted
WARNING Dont allow access to the universe unless you really know what you are doing.
PS The WAMPserver Online/Offline feature only controls access and does not mean APache is running or not. Also once you implement Virtual Hosts it no longer has any relevance and shoudl be set OFFLINE as access control is now held in each individual Virtual Host.