Cannot access XAMPP (1.7.3) from my local network - xampp

I am running XAMPP 1.7.3 on windows 7. My problem is that when I try to access my server (localhost) from another computer, the server does not respond. For example, [on my computer] when I type in 'http://localhost', my pages come up. However, when I try accessing 'http://192.168.0.102' from my computer, nothing happens. When I type in my external IP, nothing shows up, but when add HTTPS to the external IP, my Linksys WRT54GS config page shows up, asking for a password. I have already tried port forwarding and a local "static IP", and no luck, other than my local IP never changing. Can anyone help me?

Here's how I have my XAMPP installation configured. Maybe it will work for you.
Open C:\xampp\apache\conf\extra\httpd-vhosts.conf
Add a VirtualHost block for each site you are running:
Apache config
<VirtualHost *:80>
ServerAdmin webmaster#localhost
DocumentRoot C:/path/to/website/files
ServerName exampledomain.dev
<Directory "C:/path/to/website/files">
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
Add a line to your hosts
127.0.0.1 exampledomain.dev
On the connecting computer's host file:
192.168.0.102 exampledomain.dev
You can easily access your hosts file by using ctrl+r and running
notepad %SYSTEMROOT%\system32\drivers\etc\hosts

Related

How setup Apache Virtual Host to Laravel on Ubuntu Server 20.04?

I have a server running Ubuntu 20.04 and Apache 2 that I use as a webserver. I made a configuration of a virtual host to point to a Laravel application, as you can see in the configuration file below.
<VirtualHost laravel-8.test>
DocumentRoot /var/www/laravel-8/public
ServerName laravel-8.test
<Directory "/var/www/laravel-8/public">
allow from all
Options None
Require all granted
</Directory>
</VirtualHost>
And everything works perfectly on the server, but when I try to access the address laravel-8.test from another machine on the network, it goes to the Apache page. I even added in the Ubuntu hosts file to inform the address.
127.0.0.1 laravel-8.test
And I did the same on the workstation (Windows 10 Pro), I added the line
192.168.0.112 laravel-8.test
What am I doing wrong? I have the necessary Apache modules for Laravel to work (rewrite)
change your v-host config to something like this...
<VirtualHost *:80>
DocumentRoot /var/www/laravel-8/public
ServerName laravel-8.test
<Directory "/var/www/laravel-8/public">
allow from all
Options None
Require all granted
</Directory>
</VirtualHost>
If you want to connect from another PC, you need to write an external IP.

Named virtual host not working in xampp windows

I have following config in extra\httpd-vhosts.conf
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs"
ServerName localhost
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:/xampp/htdocs/history"
ServerName history.test.in
<Directory "C:/xampp/htdocs/history">
Options All
AllowOverride All
Require all Granted
</Directory>
</VirtualHost>
Also, I enabled this in apache\conf\httpd.conf file,
Include conf/extra/httpd-vhosts.conf
In drivers\etc\hosts file, I have
127.0.0.1 localhost
127.0.0.1 history.test.in
When I try to access http://history.test.in, site is not loading but when tried with http://localhost/history, it works. Am I doing anything wrong? Also, I don't see any error logs in Apache.
The above configuration is correct. The reason for the virtual host not working was due to incorrect settings like firewall block, anti-virus software interruption, multiple OS environment etc. in system.
This post(eye-opener) helped me found the issue in windows xampp environment: https://serverfault.com/questions/452268/hosts-file-ignored-how-to-troubleshoot
especially ipconfig /displaydns DNS command helped me find that new hosts take effect correctly.
Additionally, if you are running multiple versions of OS (windows 7, vista or windows 10) in your system, make sure you edit the running drivers\etc\hosts OS's hosts file and not the idle one.

publish xampp publically from home laptop

I'm trying to publish a locally installed WordPress website - publically.
Had to reformat my laptop, so now running Windows 10 from my laptop at home.
I can already RDP to it from e.g. work PC, externally, etc.
I used to have Windows 8, WAMP installed and used to publish websites to my domain - www.site01.co.uk
site01.co.uk has been pointing to my fixed IP since I had Windows 8 and still is pointing. The fixed IP address hasn't changed.
I now opened up XAMPP httpd.conf and placed below "code" at the bottom:
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\wp"
servername http://www.site01.co.uk
<Directory "C:\xampp\htdocs\wp">
Allow from all
Require all granted
Options Indexes
</Directory>
</VirtualHost>
This didn't work .
WordPress is installed in htdocs\wp folder.
You have a couple of problems with your Virtual Hosts definition. Virtual Hosts is definitely the way to go though.
When you create a Virtual Host Apache ignores the default definition of localhost in your httpd.conf file so its always a good idea to include a VH definition for that as the first VH defined, with access limited to Require local this helps stop drive-by ip address access attempts as the Require local will return an Access denied if you/they just use your WAN ip to try and see whats on your web server.
This should go in the \xampp\apache\conf\extra\httpd-vhosts.conf file. Remove all the example stuff from that file when you add this definition.
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs"
ServerName localhost
<Directory "C:\xampp\htdocs">
AllowOverride All
Options Indexes FollowSymLinks
Require local
</Directory>
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "C:\xampp\htdocs\wp"
ServerName site01.co.uk
ServerAlias www.site01.co.uk
<Directory "C:\xampp\htdocs\wp">
AllowOverride All
Options Indexes FollowSymLinks
Require all granted
</Directory>
</VirtualHost>
Apache 2.4 uses the Require parameter and not the Allow/Deny which was Apache 2.2 syntax.
You now edit the httpd.conf file and find the
# Virtual hosts
#Include conf/extra/httpd-vhosts.conf
and remove the # comment like so
# Virtual hosts
Include conf/extra/httpd-vhosts.conf
Then make sure that the Port Forwarding on your router is forwarding port 80 to the correct ip address for your PC.

Windows, Apache, Acrylic DNS, and wildcard subdomains

I'm trying to set up dynamic VirtualHosts subdomains using Apache 2.4 on Windows 8.1 with Acrylic DNS Proxy, but I'm running in to problems with Server Not Found errors. I've read so many answers already, like this one, but I can't figure out what's wrong or how to fix it.
My aim is to set up a local domain (http://localhost.pc) to serve all subdomains dynamically from folders in /htdocs, so http://test.localhost.pc/ from /htdocs/test/ etc. My VirtualHost config is set up as
<VirtualHost *:80>
UseCanonicalName Off
ServerName localhost.pc
ServerAlias localhost.pc www.localhost.pc
DocumentRoot C:/dev/apache/htdocs/
<Directory />
Options FollowSymLinks Includes ExecCGI Indexes
IndexOptions FancyIndexing HTMLTable FoldersFirst
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
<VirtualHost *:80>
UseCanonicalName Off
ServerName localhost.pc
ServerAlias *.localhost.pc
VirtualDocumentRoot C:/dev/apache/htdocs/%1/
<Directory />
Options FollowSymLinks Includes ExecCGI
IndexOptions FancyIndexing HTMLTable FoldersFirst
AllowOverride All
Require all granted
</Directory>
</VirtualHost>
I've installed Acrylic DNS Proxy, I've changed the IPv4 DNS server to 127.0.0.1 for my WiFi and my (disconnected) Ethernet, and I've edited AcrylicHosts.txt to include the line
127.0.0.1 localhost.pc *.localhost.pc
Acrylic seems to work fine, I've enabled the debug log and hit log and regular internet browsing works fine. However, if I visit my local domain or subdomains I get the server not found error despite Acrylic's debug log saying
TResolver.Execute: Request ID 34019 received from client 127.0.0.1:55587 [Q=localhost.pc;T=AAAA;Z=84E301000001000000000000096C6F63616C686F737403706D6100001C0001].
TResolver.Execute: Response ID 34019 sent to client 127.0.0.1:55587 directly from hosts cache.
And the hit log saying
127.0.0.1 H Q=localhost.pc;T=A
127.0.0.1 H Q=localhost.pc;T=AAAA
Pinging localhost.pc from the command line fails (could not find host), but nslookup looks right
C:\>nslookup localhost.pc
Server: UnKnown
Address: 127.0.0.1
Name: localhost.pc
Addresses: 127.0.0.1
127.0.0.1
If I then add 127.0.0.1 localhost.pc to C:\Windows\System32\drivers\etc\hosts and flush the DNS cache, I can at least get http://localhost.pc/ to load. The whole point of Acrylic is being able to use wildcards, but http://test.localhost.pc only works if I manually add it, and any other subdomain/folder, to the Windows hosts file.
So I'm guessing Acrylic is the problem if adding entries to the Windows hosts file manually gets things working. Does anyone have any ideas what is going wrong and how to fix it?
I've fixed a bug regarding AAAA queries not resolved properly from the AcrylicHosts.txt file in versions <= 0.9.27.
If you use the latest (0.9.28) version you should be fine.

Set up xampp server on office lan

Im looking to set up a server using xampp within a small office. I will ofcourse secure xampp but in order to make my webapp available to the other 4 PCs on the network do i just create a virtual host? Is there a way to ensure that access to the webapp is only available on the lan?
The current setup includes 4 pcs sharing an internet connection via a router. How can i set this up as a lan which i can provide access to my webapp?
Use an .htaccess file or set up permissions in the VirtualHost tags in httpd.conf. All you have to do is put this in a file named .htaccess inside of the folder holding your webpages:
order deny,allow
deny from all
allow from <ip you want>
allow from <ip you want>
allow from <ip you want>
etc...
Perhaps you can try.
open and make sure C:/xampp/apache/conf/httpd.conf
DocumentRoot “C:/xampp/htdocs”
Options Indexes FollowSymLinks
AllowOverride all
Order Deny,Allow
Allow from all
and open C:/xampp/apache/conf/extra/httpd-vhost.conf add ..
NameVirtualHost name_site:80
<VirtualHost name_site:80>
DocumentRoot C:/xampp/htdocs/folder_site/
ServerAdmin root#gmail.com
ServerName xxx.xxx.xxx.xxx
</VirtualHost>
note: xxx.xxx.xxx.xxx is xampp computer ip.
This work on win 7.
If still dosn't work. Try to disable youe windows firewall.

Resources