How to configure Apache WebServer to be accessed by public domain (or static IP) I have? - apache

I am trying to setup a web-server at home on PC.
I have an Static IP address (say 1.2.3.4 or Domain XYZ[dot]com), which I have configured on my router.
When I try to access, XYZ[dot]com or "1.2.3.4", it opens my routers login page.
On the other hand, Apache Server, installed on the PC, works fine. when I write localhost/index.html or 127.0.0.1/index.html - it opens that page.
QUESTION
How can I link the Public IP address to the Apache Server (or the website hosted on localhost on my PC)?
EXPECTED SOLUTION
If anyone visits "http://XYZ[dot]com", the website hosted on my PC is opened on his/her web browser.

The router's login page is usually accessed via a private IP. The router's admin interface shouldn't be made available to the Public Internet.
What you need to do is:
find out what your router's public IP is (you can use http://whatismyipaddress.com/)
setup port forwarding on your router. You want connections made to the routers public IP to be forwarded to your PC. Ex: Your router's public IP is 21.21.21.21 and your PC's private IP is 192.168.0.100. You need to configure a rule which says that any connection made to to 21.21.21.21:80 needs to be forwarded to 192.168.0.100:80
As for the http://XYZ[dot]com part you need to setup that domain pointing to your public IP with a com. DNS registrar and configure an apache virtual host for that domain (http://httpd.apache.org/docs/2.2/vhosts/)

If you have static IP ADDRESS then you don't need to do anything extra you just have to add apache exception in firewall then tick the checkbox under private and public column and you are done. then anyone can access your website all over the world.

You will need to create a permission for that port on your firewall and configure the ports on your router. Keep in mind that most internet providers have business and residential plans. In residential plans it is common for them to block access to ports 443 and 80 externally (enabling your router will not change that because the requests will not even arrive on it).
An excellent step by step for those who use linux and also want to set up a domain name

Related

Accessing Public Page from AWS Ubuntu server

I am new to Amazon Web service. I created an Ubuntu 16 instance with AWS. Installed Apache and restarted the service. But still I am unable to figure out how to access the start page from a browser. Which IP address should I use? Public ip or elastic ip? Also do I need to change any configuration file? Thanks.
You need to use the public IP address, depending on your usecase you can even use an elastic IP address.
However you need to configure your security groups in order to access the web page.
Go to your security groups
Select the relevant security group
Add inbound rule to port 80 (TCP)
Then you will be able to access the page. Please refer this guide for more information.
You can use public ip / public DNS. These both will change upon restart of an instance. Elastic IP is useful when you want your IP address to be persistent. e.g. To make an entry in your domain DNS records.
Make sure your default site is pointing to correct directory as you are going to access using IP address.
If your instance is in VPC then it must be in public subnet. (subnet with Internet Gateway route attached)

Apache2 server inaccessible from outside

I have a LAMP(ubuntu-16.04, PHP) setup and while using it I am able to access it from home network, (phones, etc.) but for others it says that the site can't be reached. I go to my page via my IP and have no problem reaching it. Are there any steps that I can do? I have tried running node.js as well and i have the same problem there.
There is probably a firewall between your home and the Internet. A firewall prevents connections from the Internet. In fact, some one else, in another home, might have a computer with the same IPv4 address as you have. To make your web server public, you need a public IP address (globally allocated uniquely to you) and you need to route that address to your webserver.
Use a webserver proxy service such as PageKite.
Alternatively method:
Your router most likely already has a public IPv4 address. On http://192.168.1.1 or http://192.168.1.254 or a comparable administration page (usually accessible using the user admin with the password admin, or with a user with the same name as your ISP and that same name as password) you can configure your server as a public web server.

What will be the DNS name for Virtual Machine instance created in IBM Bluemix?

I have created a Virtual Machine in Bluemix. I have installed NGINX web server on it. To access the web application that is deployed on NGINX, should I use a public IP address (for e.g. http://123.456.78.9) or is there a domain name associated with the instance (something like http://abcxyz.bluemix.net)?
When you launch any VM in cloud by default they should be not accessible from public internet unless you attach a public ip address to them.
Once you have attached a public ip address to your instance and configured the firewalls to allow incoming connections (http, ssh etc) you can update your DNS server to redirect traffic there.
AWS create a public FQDN at the time of launching the ec2 instances as
ec2-nn-nn-nn-nn-region-compute.com (where nn are ip address bits), not sure any similar thing with bluemix but it is less likely to have abcxyz.bluemix.

how to access local web application on glassfish server from internet?

I have created a web application in glassfish and I can access it on my LAN.
How can I access the web application from a remote location over internet?
I do not have static IP.
Please reply.
Thanks.
Steps :
Creating virtual DNS(Domain name server) Server on your machine.
Port Forwarding.
Reference https://cookbook.fortinet.com/port-forwarding-60/
Remote Desktop Connection enabling.
Creating Inbound Rules. Reference :
https://www.howtogeek.com/112564/how-to-create-advanced-firewall-rules-in-the-windows-firewall/
Creating account on www.noip.com and create custom host and download DUC (Dynamic Update Client) Software.
Some more steps may have it depends on your LAN Router and firewall configuration.Use http://ifconfig.me/ to get your public ip.
Access from outside your machine should be configured by default. You may check if it is so in admin console, at Configurations->server-config->Network config->Listenters. There should be one listening on the desired port (like 8080) and be bound to 0.0.0.0 address.
To easily access something behind a dynamic ip you need something like http://www.noip.com/ or http://www.dnsomatic.com/ (I took these from my router's control panel)
I did this recently,
first you need to use port forwarding on your router, access it by typing your default gateway path, mine was 192.168.0.1 then go to "advanced settings -> Port forwarding". Simply enter the details that are asked for, I set mine to HTTP using port 8080, yours might be different. Protocol is TCP. The IP address it asks for is your local address.
For quick testing you can disable the firewall on your machine and then you can search on google for your Public IP address by typing "what is my IP".
Then type your ip into the browser and the port number "ipAddress:portNumber"
You should see the glassfish welcome screen if it is successful.
After that you might want to enable your firewall again but then you have to add an inbound rules to allow the port to be used:
Setting Windows inbound rules
Then you still have one last step to perform, allowing glassfish to access the resources on your machine: Adding glassfish to allowed programs
Follow the instructions on adding java.exe only.

getting router confuguration page instead of my web home page of my website

I am trying to host a website from my local pc. For that i have installed apache server, registered a domain name and done the necessary settings.The problem is that when I am trying to access my homepage I am getting the router configuration page, same is happening when I am trying to access the website from other computer.Please help.
When hosting a website from a local PC behind a router you need to be careful to use the public IP that your service provider has given you. Beware this is often not a static address and may change frequently. To address this you can use some type of DynDNS service if your router supports it.
Second, you will need to add a rule in your router's firewall to allow the traffic from the public internet to reach the computer behind the router. This can be done either with a DMZ (less secure) or a port forwarding.
When you are trying to access the web page, type in the local ip of the computer you have setup the server on. This should take you to the apache server. You are likely just typing in the wrong IP. Try something like http://127.0.0.1/ (127.0.0.1 is the same as localhost) to make sure you get the apache server from the computer that is running the server.