how to access my web app in apache-ubuntu with custom domain name in a LAN? - apache

I have developed a web app using laravel & apache 2.4 in ubuntu 15.04 inside vmware. I have configured ip address of the ubuntu as static which is 192.168.1.250.
Within ubuntu i can access the web app from ip 127.0.0.1 or localhost. And from the networked devices, i can access it using the ubuntu's ip address 192.168.1.250.
Now, i want to access the web app using a domain name from the networked devices instead of IP address. I think i need to install and configure dns server in ubuntu along with apache. So, i installed BIND dns and tried to configure it but failed. So, if it can be done with BIND, then i was wondering HOW? If not, then what may be another way? Thank you !

You can create a tunnel to your local environment by using ngrok which will give you a temporary address (to keep the address static you have to use pro features a.k.a paid features)
Follow this steps:
Download ngrok and unzip ngrok
Open a cmd / terminal and navigate to ngrok location
Type the following command:
ngrok http {your_localhost_server_port_number}
It will create the tunnel but we need to point a virtual host to it so edit your local server virtual host and add an alias / server name like following:
NOTE: if you only have one app running on your local server this step is optional
*.ngrok.io
Now restart your local server to load our new configuration
Now you are able to see your localhost site online by using the ngrok provided url.
Enjoy!

Related

Web access to Gluu v4.0 server, installed on Ubuntu 20 machine

I have installed Gluu server version 4.0 on an Ubuntu ver.20 powered machine. After running setup script I am able to login to server from command line and according to Gluu docs I should be able to access UI from web browser using this pattern https://<hostname-where-gluu-server-installed>.
But this doesn't work. I have enabled port 443. Both browser and server are on the same machine. Thanks in advance for your answers!
Gluu must be deployed on a server or VM with a static IP Address. The static IP address should resolve to a computer hostname which can be achieved by adding an entry to the DNS server or in /etc/hosts.
More information on official Gluu docs:
https://gluu.org/docs/gluu-server/4.0/installation-guide/

Host web on local machine use xampp

I want to access my website hosted on local machine on htdocs in xampp, I want to access it using an IP address, How can I get it where like:
https://locahost/
and can I get using an IP address?
can you help me the best tutorial link easy step by step to make it on window 10?
http://localhost:port like http://localhost:8080 i think. You need to specify a port.
You can access your XAMPP website using the following web addresses in the device it is hosted on, usually:
http://127.0.0.1:80
And
http://localhost:80
To access your website from your smartphone or another PC, you will need to access it using your local IP address assigned from your router. Run ipconfig to see it:
You will need to find the line in the output, like: IPv4 Address.........: 192.168.0.123
For port 80 and 443, you do not need to type the number after the address, i.e. :80 or :443. If you are using other ports, you will need to specify them.

Hosting site using xampp server from local network without port-forwarding

I want to make my site available world wide. Im using xampp server for hosting. I have no access to any kind of servers and modems. Situation is shown below:
My site server has local ip assigned by wifi router and it runs Windows 8.
Remember I have no access on any kind of servers and modems so port port-forwarding is impossible (out of my scope).
Its actually difficult, but not impossible.
One way, I would approach this is:
I would host a page on internet.
Then take request and store it in database.
One of my program will always be running from my computer.
Then check for request and curl the request to localhost. For this you may use Node.js (taking data from database using GET method and curl it to localhost).
This is the best I could think of. And I am working on it, when the code is ready I'll make it open source and notify you :)
But still, it's difficult, as you need to put user's request to sleep for 2 seconds and then transferring it.
Its slow, but may work out for you.
Disadvantages:
Program will be very slow and memory usage will be more.
Breaking may happen many times.
High bandwidth wastage
If not encrypted, MIM (Men in Middle) may possible.
Advantages:
Indirect method of hosting
Need not to worry about your code being lost.
I am looking forward for a better alternative and I would like to keep this question for bounty once again.
If you cannot open the necessary ports within your LAN you will require access to an external server. However, the external server does not need to host any code, e.g.
Create a Linux based ec2 instance using Amazon's free tier.
Install a package to redirect remote to local ports:
a. using socat:
Install socat using your distributions package manager
Connect via SSH: ssh -N -R 42500:127.0.0.1:80 -o ServerAliveInterval=60 ubuntu#xxx.xxx.xxx.xxx -N -R 8080:localhost:80 "socat TCP-LISTEN:8080,fork TCP:127.0.0.1:42500"
b. using a webserver and reverse proxy:
Install apache or nginx and any required reverse proxy modules and configure your VirtualHost to proxy requests to a local port, e.g. :8080 -> 127.0.0.1:42500
Connect via SSH: ssh -N -R 42500:127.0.0.1:80 -o ServerAliveInterval=60 ubuntu#xxx.xxx.xxx.xxx
Your machine is now reachable via the ec2 instance http://xxx.xxx.xxx.xxx:8080/.
I occasionally use this technique when debugging web service callbacks.
Update 17-02-2014
If you are a Windows user you will need to install a third-party tool to support ssh. Options include:
cygwin
git bash
PuTTY
PuTTY is the easiest choice if you are not familiar with *nix tools. To configure remote port forwarding in PuTTY expand the following setting: Connection -> SSH -> Tunnels. Given the previously described scenario, populate Source port as 42500, Desination as 127.0.0.1:80 and tick the Remote option. (You may also need to add the path to a PuTTY compatible private key in the Connection -> SSH -> Auth tab depending on your server configuration.
To test you have successfully forwarded a port, execute the command netstat -lnt on your server. You will see output similar to:
tcp 0 0 127.0.0.1:42500 0.0.0.0:* LISTEN
Finally you can test with curl http://127.0.0.1:42500. You will see the output of your own machines web root running on port 80.
if you don't have a public IP address and cannot use port forwarding it is impossible to host the site
As people have said you need a public IP address. However, even if you did you should not use xampp as a public server, as it is designed for development and therefore has some security settings disabled.
I would recommend buying some shared web hosting, and uploading it to that. (you can get cheap hosting if you google 'shared web hosting', plus free .tk domains are avaliable: http://www.dot.tk/)
Do your company has any vpn network?
If it does and you have access to the vpn network, you can include your server to the vpn network and your guest will only need to login to your company vpn network then access your site like in a local network without using port forwarding. And since your data is very confidential, I assume that using vpn will also help to increase the security of your data.
Please correct me if I'm wrong.
Thank You.
What you are asking is not possible without port forwarding.
Lets break it into steps.
To host your site locally you will need a IP that is static so that
users can access it specifically.
You will need a domain so that it can be converted into user friendly name.
A 24x7 Internet Connection is must! You added a Wifi Router in your Diagram and most of today's router are capable of port forwarding.
What i will do in your scenario is:
Instead of using XAMP, i will install WAMP because i am more familiar with it and easy to configure.(totally personal preference)
Then i would set my server "ONLINE".(Google how to set WAMP server online)
Forward port "80" from router settings to my local computer ip address.(mostly it is tagged as "Virtual Server","Firewall","Port Forwarding",etc vary router to router in settings)
Suppose you have a local ip "192.168.1.3" and global/router IP "254.232.123.232" then you would redirect all the HTTP request done towards router to your local IP.
[[[[254.232.123.232]]]] --+ :80 +-- --------->192.168.1.3
That is good for now, but then you will need to tackle dynamic IP problem of router. But don't worry, thanks to some free sites that will be easy!
Go to no-ip.org -> Setup Account -> and create a entry, just a subdomain for now to test whether everything is working fine.(subdomain like mysite.no-ip.org, later purchase a real Domain)
Input your IP address there(Router IP) and download its application which will automatically update their server if your local IP changes.
Wait for some minutes and Voila! Your site is live.

How to set a custom website name instead of ip address for local computer?

I can point a url to a directory in my computer by setting /etc/host and /private/etc/apache2/extra/httpd-vhosts.conf files. For instance, when i type sample-app.com in my computer, website under /Users/azad/works/sample-app.com folder is running.
When someone type sample-app.com in another computer in same local network i want to display the same website located on my computer. Is this possible?
By the way, i don't have access to any computer in the local network and i can't do any configuration.
Mac 10.7.5 (I am using mac but if windows is better for this purpose i can use windows too),
PHP 5.3,
Apache 2.2
If you want to accomplish this on windows, use the hosts file on the computers you want to point at that sample-app.com URL mapping your IP address to that URL in all the computers you want that to work on. Then make sure your HTTP server is configured to serve that website under that host name for port 80.
Since you aren't able to configure the local network, the best way to handle this situation is to configure a host name with the website domain's DNS server, such as dev.sample-app.com, which points to the local IP address (seeing as how its on the local network) of the computer hosting the website. This will then allow other computers on the local network to enter this host name to access the webiste.
If you had control of the local network's DNS server or control of the proxy (if they have a proxy), there would, of course, be other options.
Update:
Since you mentioned in your comment that you have control over the DNS server, here is how you could accomplish your goal via the DNS server. First, add a forward lookup zone for sample-app.com to the DNS server. Second, configure the default host for the zone to point to the computer serving up the website content. Now the client computers will resolve the local IP when the user enters sample-app.com into their web browsers. If you need to continue to have access to other hosts on sample-app.com, you might want to try asking about it on serverfault.

how to make apache server public

I want to convert my pc to a web server. I installed centos server and apache server.
How I can make apache server public? I want to everyone access my web site on my pc via browser.
Thank you..
You have 2 ways, you can buy a domain and a static IP address for your computer (usually through the service provider) and configure your router and FW to allow access to the machine for port 80.
The other way is to use some sort of dynamic dns service like DynDNS to be able to bind a DNS to a dynamic IP address (you will need to run a daemon to update the account once in a while because your IP may change). The FW and router rules are still needed in this case as well.
After you do one of the these steps everyone should be able to access your apache server on your computer as long as it's on.