Access xampp with domain name on phone device on lan - mobile

Is it possible to acces to your Localhost xampp with domain name on phone device on lan?
I can access it on Computer with
127.0.0.1 example.com
inside of System32/drivers/etc/hosts
and some changes in xampp
<VirtualHost *:80>
DocumentRoot C:/xampp/htdocs
ServerName www.example.com
ServerAlias example.com
</VirtualHost>
inside of xampp/apache/conf/exstra/httpd-vhosts.conf
But is it possible to access it on phone device instead of writing my ip adress to the url bar?
I don't want applications like ngrok.com or others.
SPECS.: Windows 7, localhost port :80
Thanks for response!

Related

apache2 virtualHost Name-based hosts on more than one IP address

is it possible when people access example.namedomain.com will go to documentRoot /var/www/html (192.168.10.8)
but when typing the address example.namedomain.com/test
then it will go to documentRoot /var/www/html/test on a different other local server (192.168.10.9)?

What is the correct way to set up a virtual host running on Apache?

I configured apache on ubuntu 16.04 and I created a virtual host with these instructions:
<Directory /var/www/html/example.com/public_html>
Require all granted
</Directory>
<VirtualHost *:80>
ServerName example.com
ServerAlias www.example.com
ServerAdmin webmaster#localhost
DocumentRoot /var/www/html/example.com/public_html
ErrorLog /var/www/html/example.com/logs/error.log
CustomLog /var/www/html/example.com/logs/access.log combined
</VirtualHost>
when I try to open the page www.example.com on my browser I see this message:
This domain is established to be used for illustrative examples in documents. You may use this domain in examples without prior coordination or asking for permission.
Should I use another name instead of "example" to solve the problem?
Ok any name? For example "myname.com"
For clarity, I only need this for local tests
www.example.com is actual website that somebody else owns, has it registered in DNS and has some content on it. When you open the address in browser, your computer first asks DNS server (presumably one setup by your ISP). DNS then responds, that www.example.com is ran on 93.184.216.34 - which is probably not your machine. This is where the message is from.
Now, what is the meaning of ServerName and ServerAlias then? It is actualy a directive for your webserver, running on your machine, to know which packets are meant for given virtual host. It does not affect how your browser will transalate them.
For the sake of local testing (both server and browser are on same OS), all you need to do is to create virtualhost for a 'localhost'. This is a reserved address for the machine currently being used. Simply put:
ServerName localhost
ServerAlias localhost
into your virtualhost and you will be able to access the webserver by entering 'localhost' into your browser.
In case you would need more than one host locally, you can override the dns by editing the host file https://en.wikipedia.org/wiki/Hosts_(file) - for example, in windows by adding hosts records like:
127.0.0.1 app.local
127.0.0.1 db.local
and then creating two different virtual hosts, one with alias app.local, second with db.local. Then, the OS will then route requests from your browser correctly to your machine per hosts file. Your websever will then sort your request according to the header to proper virtualhost.
You might want to check out some general information on how dns and internet protocol works:
https://en.wikipedia.org/wiki/Internet_protocol_suite
https://en.wikipedia.org/wiki/Internet_Protocol
https://en.wikipedia.org/wiki/Domain_Name_System

VirtualBox: How to access virtual host on VM from host?

How to access from the host the Apache virtual domain created on virtual machine.
Settings of the VM on VirtualBox:
VM ubuntu/precise32 on VirtualBox created with vagrantfile from How to setup a LAMP development environment in Vagrant by Sanchit Jain Rasiya
installed Apache/2.2.22
installed Lynx browser
Virtual Host /etc/apache2/sites-available/example.com
ServerAdmin webmaster#example.com
ServerName example.com
DocumentRoot /home/vagrant/www/example.com
AllowOverride All
Order allow,deny
Allow from all
ErrorLog "/home/vagrant/www/example.com/logs/example.com-error.log"
CustomLog "/home/vagrant/www/example.com/logs/example.com-access.log" combined
From the browser on the host machine I can access VM's localhost as http://192.168.205.10/index.html
How can I access VM's example.com?
On the host's /etc/hosts I have added line for example.com
127.0.0.1 localhost
127.0.0.2 tmp.loc
127.0.0.3 temp.loc
192.168.205.10 example.com
When I try http://example.com/mj.html I get the 404 Not Found page from Apache/2.2.22 (Ubuntu) Server at example.com Port 80
On the virtual machine I can access page with the Lynx
lynx http://example.com/mj.html
This is noted in the /home/vagrant/www/example.com/logs/example.com-access.log file as
127.0.0.1 - - [03/Apr/2016:15:53:49 +0000] "GET /mj.html HTTP/1.0" 200 344 "-" "Lynx/2.8.8dev.9 libwww-FM/2.14 SSL-MM/1.4.1 GNUTLS/2.12.14"
But when I try to access example.com from the host there are no logs neither in access.log nor /home/vagrant/www/example.com/logs/example.com-error.log
There are no logs in the host's Server files /opt/lampp/logs/access_log and /opt/lampp/logs/error_log
On Ubuntu /etc/hosts:
127.0.0.1 localhost
127.0.2.2 example.com
On Windows (VBox) C:\Windows\System32\drivers\etc\hosts:
10.0.2.2 localhost
10.0.2.2 example.com
Then just reboot your VBox Windows and type in browser (on Windows):
http://example.com/
I have the same issue, I've been trying to access my drupal project from my virtualbox vm but it is not working. One of the solutions I found on the Internet is using the outer keyword in your hosts file in the VM.
The following works fine for me:
In your host machine (let's say a ubuntu) type: ifconfig, and get the
inet address of wlan0 (example: 192.168.1.15)
Add this address to the host file in your virtualobox machine and use the outer keyword
[192.168.1.15 outer]
Now you can access your localhost from your virtualbox browser by typing the address of your wlan0 (ex: 192.168.1.15).
If you need to access a specific port on your host add the port number to
the address example 192.168.1.15:8001

configurations for the Subdomain module in drupal 7

What are the appropriate configurations for the Subdomain module in drupal 7 on Window 7 running XAMPP?
My site is localhost/example
Here are the changes I have made:
settings.php
$cookie_domain = '';
Leaving this commented out gives me an error
"The $cookie_domain variable in settings.php is not set".
Uncommenting and putting in "localhost", ".localhost", "example", ".example" gives me an "Access denied" error.
It seems to accept "localhost/example" or a blank ' ', although I don't know if this is the right thing to do.
host
127.0.1.1 localhost example
(and I can successfully ping ideastar)
http.conf
NameVirtualHost *:80
<VirtualHost *:80>
ServerName example
ServerAlias *.example
DocumentRoot C:/xampp/htdocs
</VirtualHost>
getting the fallowing error
Subdomain error: localhost and subdomain-test.localhost did not resolve to the same IP address. Your DNS may be improperly configured and subdomains will likely not work.
First you should create two virtual host one for main domain and another for sub-domain. For ex: like we have two domains example.com and test.example.com to setup on local host. I am assuming that you have a fresh install of Xampp on your machine. Your virtual host [\xampp\apache\conf\extra\httpd-vhosts.conf] file should have these entries:
<VirtualHost *:80>
DocumentRoot "\xampp\htdocs\example"
ServerName example.com
ServerAlias example.com
</VirtualHost>
<VirtualHost *:80>
DocumentRoot "\xampp\htdocs\example"
ServerName test.example.com
ServerAlias test.example.com
</VirtualHost>
Now open you system host file and make the following entries below the line "127.0.1.1 localhost" (localhost ip 127.0.0.1)
127.0.1.1 example.com
127.0.1.1 test.example.com
\xampp\htdocs\example this directory should contain your Drupal setup.
Cookie domain entry should be as per the below line
$cookie_domain = '.example.com';
i have assumed that you already have a Drupal site running at http:\localhost\example.

Can't access my website through ip. Is something wrong with my httpd settings?

I just set up a fresh apache/mysql install on CentOS on remote server.
Right now I just want to be able to access my server through ip on my server
let's say the ip is 64.123.myip.whatever
Here is my /etc/httpd/conf/httpd.conf setting
### Section 2: 'Main' server configuration
ServerName 64.123.myip.whatever:80
### Section 3: Virtual Hosts
<VirtualHost *:80>
ServerAdmin webmaster#dummy-host.example.com
DocumentRoot /var/www/html
ServerName 64.123.myip.whatever
ErrorLog logs/error_log
CustomLog logs/access_log common
</VirtualHost>
I restart my apache, try to access this server and I get this error in the browser
Oops! Google Chrome could not connect to 64.123.myip.whatever
Why doesn't this work?
A couple of things. First... do you literally mean IP address? If so then putting that into Chrome is going to actually go right to that address. The odds of that random IP address actually hosting a webserver is fairly remote, hence the error. ServerName cannot be an IP address. If you instead mean you're trying to use a ServerName of "64.123.myip.whatever", then you must add a host entry that directs all traffic for "64.123.myip.whatever" to the IP address of your web server (presumably 127.0.0.1).

Resources