Using DNS with Linux Server - html

I have apache, php, mysql, etc. setup on my 16.04 linux ubuntu server. I can access the webpage I have createdin /var/www/html/index.php using 10.0.0.8 now I want to use a domain name or even an IP address to access the server off of a local connection and on another internet connection. What do I have to do to do this I have no clue and I have no clue what to google to find out.

You should buy a domain name from a provider such as GoDaddy and assign it to your public IP address. Visit a public "What's my IP?" site to find your public IP address or look in your router settings to see what address was provided by your ISP. You'll probably have to enable port forwarding on your route for port 80 to 10.0.0.8.

Related

How can I share the output of an html code written in visual studio code with someone else?

I don't think that we can share the link that we get from the live server extension to someone else for viewing our web page.
kindly advise me. I am new to front-end development.
By default LiveServer will listen for network connections on 127.0.0.1 and is available only to clients running on the same computer.
You can change that in the settings (under Live Server > Settings:Host) to specify any IP address allocated to the computer you are working on. You can also use 0.0.0.0 for every IP address allocated to that computer.
Anyone who can reach the IP address you select (which is typically anyone on the same LAN as you) can then visit http://192.0.0.10:5500/ to see the site. (Replace the IP address in that example with the one assigned to your computer that you selected above).
For someone to access the server from a different network, you will need to have an IP address on the public Internet. Typically you would get this by following the above instructions and then configuring your router to forward port 5500 from its Internet facing IP address to the IP address of your computer on the LAN.
You can also look at tunnelling a connection with by creating an SSH tunnel manually or using a service like ngrok which connects a URL on the public Internet to your local server (note that this removes the requirement to change the Live Server configuration away from 127.0.0.1).

People on an other network can't connect to my WAMP server

I'm trying to host a WAMP server (WAMP version 3.0.6 on windows 10) and http:'//localhost, my internal IP and external IP (I forwarded port 80) are working. I Also registered a free .tk domain that's working on my network. But on other WiFi networks people can't connect to my server using my external IP or my domain.
I tested it on my smartphone (using mobile data to simulate the other WiFi network) and I got the error [My server's IP] took too long to respond.
How can I fix this?
In this case you have to make sure that the router is firstly directing to your server machine(local IPs generally have the form 192.168.x.x) and to the correct port ,so if WAMP's Apache is running on port 80 router must redirect to your machine's 80 port.
I've fixed it.
I double checked my port forwarding settings and changed the external IP from port 80. Then I saw a text: "When the External IP address is 0.0.0.0 you can access this port forwarding on internet, if you set a specific External IP address here the access is limited to only this IP address on internet", so I changed my external IP to 0.0.0.0 and now it's working!

How to set a name for Apache server?

I created successfully a apache server but I dont want to connect to it by typing 192.168.0.102, I want a normal url like www.google.com. How can I do that? I went to httpd.conf and found the ServerName line but setting it to something like www.mysite.com doesnt seem to work. I also tried to use my external ip(https://www.whatismyip.com) as server name but it doesnt connect. It only works if I try to connect to 192.168.0.102 or localhost. How do i solve this? Thanks
There are three basic things you need to know.
Virtual name hosting
HTTP allows multiple websites to be hosted on the same IP address and port. The client uses the Host request header to tell the server which site it wants to get data for.
ServerName is used as part of this.
… but the client needs to know how to send a request to the server first.
DNS
When a client makes a request to a server, it uses the IP address of the server in order to allow it to be passed over the network (or networks) to it. It is the address.
IP addresses are sequence so of numbers, which aren't very friendly for humans to work with.
DNS translates friendly names (like www.example.com) into IP addresses.
The client has to look up the name to find the IP address. It normally does this through the main DNS system, and in order to get your name linked to your IP address you will need to find a domain name registrar and pay them.
It is also possible to set up DNS at a local level on a private network, and on a computer-by-computer level using a hosts file.
Routing
The IP address of the server has to be routable from the computer the client is running on.
192.168.0.102 is a private address, accessibly only on the same LAN. To make it accessible to clients on the Internet you need to either:
Set up your router to use port forwarding and then use the Internet facing IP address of the router (which https://www.whatismyip.com tells you) or
Give your computer a public IP address and configure your router to route traffic to it (this generally isn't possible on consumer grade routers).
In short, you can't. 192.168.0.102 is not accessible from the Internet it is internal IP.
But you have some alternatives, like if you like to access your computer from a hostname you can use dynamic DNS servers.
Or you want to test your code on a spectacular domain, you can add 192.168.0.102 with a domain to your hosts file, then only you can use this domain with your local computer.
But, If you really want to serve some content to the Internet from your local computer you have to find a DNS server service (like cloudflare) to point your domain to your public Internet ip not to 192.168.0.102.
You configure the virtual host and set the server name to the domain name you want. After that, Apache will check the requests and will use that virtual host if a request was made for that domain name. In order for that to work, that domain should point to your IP address where the server is running.
If you want to test if the configuration works, edit your /etc/hosts file and add that domain name to 127.0.0.1. After that you will be able to access to that virtual host if you try to access to that domain name from your browser.
More info here : https://httpd.apache.org/docs/current/vhosts/name-based.html

Connect SQL Server 2008 r2 through Internet

I have a VB.NET application that can connect to the SQL Server through LAN base, but how can I connect to it through internet, the application need to use outside, I know i need to use the public IP instead of using the IP address of the server but my public IP address that I've set in connection string can't connect to the server, Here's my connection string
Dim connstr$ = "Server=xxx.xx.xx.xxx\SQLEXPRESS,xxxx;Initial Catalog=sample_db;Integrated Security=True
Public conn As New SqlConnection(connstr)
I've try also to set the port and change the firewall restriction,enabled the TCP etc. and search a lot here but still doesn't work
Here's our network setup
PC-->router-->internet modem
1433 is the default sql server communication port. Port 1433 should be forwarded to the local IP address where your sql server runs.
1) Make sure that port 1433 is the valid communication port for sql server. You can check it from sql server configuration tools. Use actual port number rather than 1443 if it was changed by someone.
2) Find NAT (Network address translation) menu in your modem or router administration panel.
3) Forward port 1433 to your server's local IP address
4) Restart device
As a note that, your modem does not require a static IP. Your device most probably might have a new IP address after every restart. But it would be valid until you restart it once more. You can use this IP address in order to access your database remotely. It would be better but you don't have to get a static IP address.
UPDATE: You should also be sure that, port is not blocked by a program on the server such as a virus or security program.
Good luck
Google "port forwarding", which is also called Network address translation or "NAT".
The other answers are perfect but searching for the term on google should get you an idea on what it is, and how to go about it. Add your router name to the search for exact steps.
In short forward the port that SQL Server is listening on, from the router to the server machine. You will need to do some configuration on the router for that by opening the admin page. For how and details, Google "port forwarding"

Heroku Node.js Remote Mysql Database IP Address

I have a remote Mysql database that I am connecting to through Node.js on Heroku. My MySql host (bluehost) wants me to input IP Adresses of all remote MySql connections.
Heroku doesn't have a dedicated IP for my app, so how can I connect to it? Bluehost mentions something about a Class C IP on its page, but I'm not sure Heroku has one...
Also, I believe I already have all of the heroku environment variables set up correctly:
(heroku config:add EXTERNAL_DATABASE_URL=...)
Thanks :D
Here's what blue host says about dynamic ip addresses:
Dynamic IP Addresses
Having a dynamic IP address means that the connecting IP address can
change periodically depending on the Internet Service Provider (ISP).
You must update the connecting IP in Remote MySQL every time it
changes.
from https://my.bluehost.com/cgi/help/89.
So at least each time you redeploy your application, you have a chance to get a different ip address. So this seems highly impractical. Why don't you use Heroku's MySQL offering?
You can use one of 'static ip' addons and proxy connection via that static ip - see this discussion