Access Virtual Host with port via network in Mac XAMPP - macos

I Want to create a virtual host in my XAMPP with 8001 port number. And this should be accessible via my private network.
For Example: 192.168.1.2:8001
How can I do that?
Here is my Vhost code
<VirtualHost *:8001>
ServerName 192.168.1.2
DocumentRoot "/Applications/XAMPP/xamppfiles/htdocs/dir"
<Directory "/Applications/XAMPP/xamppfiles/htdocs/dir">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Require all granted
</Directory>
ErrorLog "logs/mysite.local-error_log"
</VirtualHost>

I have just added Listen 192.168.1.2:8001 to my httpd.conf file. And Its working..

Related

Apache 2.4.46 virtual hosts on windows 10

I have a virtual host configure in my httpd-vhosts.conf, and when i enable (uncommented) virtual hosts on httpd.conf and try to access localhost or any link inside local that is not configured in v-host, always show me Forbidden You don't have permission to access this resource.
(httpd-vhosts.conf)
<VirtualHost *:80>
ServerName workshop.test
ServerAlias www.workshop.test
DocumentRoot "C:/Apache24/htdocs/workshop/workshop_app/public"
ErrorLog "logs/workshop.test-error.log"
CustomLog "logs/workshop.test-access.log" common
</VirtualHost>
(httpd.conf)
Include conf/extra/httpd-vhosts.conf
Add this within your workshop.test vhost block:
<Directory "C:/Apache24/htdocs/workshop/workshop_app/public">
DirectoryIndex index.php
Options Indexes FollowSymLinks ExecCGI Includes
AllowOverride All
Require all granted
</Directory>

Installing laravel in windows with XAMPP

I recently install Laravel in my laptop. I have no problem when i install it. The problem now is when i'm trying to use punya.by instead of localhost:84/laravel/public.
I install my XAMPP in Disk : D
<VirtualHost punya.by:84>
DocumentRoot "D:/xampp/htdocs/laravel/public"
ErrorLog "logs/dummy-host.example.com-error.log"
ServerAdmin punya.by
<Directory "D:/xampp/htdocs/laravel">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
and here is my Hosts
127.0.0.1 punya.by
there is no problem when i access it with localhost:84/laravel/public but when i access it with punya.by . I get this
Not Found
HTTP Error 404. The requested resource is not found.
So how to fix this ? thanks in advance.
You need to access it by punya.by:84
Since it's listening on port 84, doesn't matter if you try to access it via IP or domain.
EDIT:
You need to define the vhost like this:
<VirtualHost 127.0.0.1:84>
DocumentRoot "D:/xampp/htdocs/laravel/public"
ServerName punya.by
<Directory "D:/xampp/htdocs/laravel/public">
Options FollowSymLinks Indexes
AllowOverride All
Order deny,allow
Allow from 127.0.0.1
Deny from all
Require all granted
</Directory>
</VirtualHost>
Basically, the virtual host listens to an IP:Port combination and only inside the declaration do you define the domain that will be matched.

Laravel 5.2 site on localhost/Wamp

I am trying to learn Laravel.
I created a project on c:/sites where I develop all my sites. I called it larabasic.dev
I cannot open the site in my browser, it keeps switching to www.larabasic.dev and tells me server not found.
I set up a virtual host like I did to all my other sites that works well.
I tried:
1. Changing server.php to index.php and copied the public/htaccess file to the root folder
2. Going to http://larabasic.dev/public
3. Going to http://larabasic.dev/public/index.php
4. Changing vhosts file to:
<VirtualHost *:80>
ServerName larabasic.dev
ServerAlias larabasic.dev
DocumentRoot "c:/sites/larabasic.dev/public"
<directory "c:/sites/larabasic.dev/public">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</directory>
</VirtualHost>
Instead of:
<VirtualHost *:80>
ServerName larabasic.dev
ServerAlias larabasic.dev
DocumentRoot "c:/sites/larabasic.dev"
<directory "c:/sites/larabasic.dev">
Options Indexes FollowSymLinks
AllowOverride all
Require all granted
</directory>
</VirtualHost>
My hosts file has these 2 entries:
127.0.0.1 larabasic.dev And
::1 larabasic.dev
Nothing helps. Again, any other sites I have developed with plain php work fine.
What am I missing?
Thank you
I've encountered the same problem and I've fixed this by giving 127.0.0.2 to my laravel application.
First, in the hosts file, you need to redirect larabasic.dev to 127.0.0.2:
127.0.0.2 larabasic.dev
Second, you need to bind the virtual host to that IP:
<VirtualHost 127.0.0.2:80>
DocumentRoot "C:/sites/larabasic.dev/public"
ServerAdmin admin#localhost
ServerName larabasic.dev
ServerAlias www.larabasic.dev
<Directory "C:/sites/larabasic.dev/public">
AllowOverride All
Options Indexes FollowSymLinks
Require local
# if you want access from other pc's on your local network
#Require ip 192.168.1
# Only if you want the world to see your site
#Require all granted
</Directory>
</VirtualHost>
This is my working configuration on my local machine.

XAMPP VirtualHosts Access From Mobile Device

Could you please help me to access XAMPP localhost sites from a mobile device (either from home network or from internet)
I am using multiple virtual hosts to access all sites using a short link for each. Please see the configuration of virtual hosts below:
<VirtualHost *:80>
ServerName mysite
ServerAlias mysite
DocumentRoot "F:/Drive/Dev/mysite"
<Directory "F:/Drive/Dev/mysite">
AllowOverride All
Options Indexes FollowSymLinks Includes ExecCGI
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
ServerName mysite2
ServerAlias mysite2
DocumentRoot "F:/Drive/Dev/mysite2"
<Directory "F:/Drive/Dev/mysite2">
AllowOverride All
Options Indexes FollowSymLinks Includes ExecCGI
Require all granted
</Directory>
</VirtualHost>
and the host file:
127.0.0.1 mysite
127.0.0.1 mysite2
I have tried several suggestion found here, but non of them helped...
Thanks in advance.
ngrok creates a secure public URL (https://yourapp.ngrok.io) to a local webserver on your machine
test mobile apps against a development backend running on your machine.
https://ngrok.com/

Wampserver can't get Named Virtual hosts to work

Using wampserver I can't get named virtual hosts to work. I've edited the httpd.conf to use the
Include conf/extra/httpd-vhosts.conf
I've added the domain to my system32/driver/etc/hosts file. I've edited the httpd-vhosts.conf file and everything seems to work except now localhost is unavailable. The domain I setup (test123.com) works fine, hitting 127.0.0.1 works fine, but hitting localhost hangs. There is nothing relevant in the error logs and no mention of it in the access logs. Here is how I have edited httpd-vhosts.conf:
#
# Virtual Hosts
#
#
# Use name-based virtual hosting.
#
NameVirtualHost *:80
# Tells Apache to serve the default WAMP Server page to "localhost"
<VirtualHost *:80>
ServerName localhost
DocumentRoot "C:/wamp/www"
<Directory "C:/wamp/www">
Options FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.php
</VirtualHost>
<VirtualHost *:80>
ServerName test123.com
ServerAlias *.test123
# Folder where the files live
DocumentRoot "D:/Projects/html/test123"
# A few helpful settings...
<Directory "D:/Projects/html/test123">
Options FollowSymLinks
AllowOverride all
Order allow,deny
Allow from all
</Directory>
DirectoryIndex index.php
</VirtualHost>
What am I doing wrong?
Finally figured it out. In httpd.conf I had to change
Listen 80
to
Listen *:80

Resources