1

I am currently working out of a book, "Mastering Ubuntu Server, (LaCroix 2018)."

I have not been through the entire book but I am having doubts so far.

I have a website URL that I want to host from a home server.

...

I got as far as getting my home server to host my IP Address. Now, I have not been able to set up ../../50-xxxx-.yaml to make this web URL become hosted by my home server w/ my own web page.

I wrote a simple, HTML file for hosting the web address and web page on this home server.

Do not get me wrong, I know what I have read online, via this book, and while attempting various, different methods on IP Addresses, home servers, and websites.

...

How can I use Ubuntu Server to set up my home server for promoting web pages instead of hosting IP Addresses?

Seth

P.S. In the meantime, I will keep searching my book, online, and via this "askubuntu.com/questions/ask" page online.

...

For instance, this is my .yaml software to host it so far.

#blah
network:
  version: 2
  renderer:networkd
  ethernets:
  enpOs3:
    dhcp4: yes

I also tried:

#blah
network:2
renderer: networkd
ethernets:
  enpOs3:
    dhcp4:no
    addresses:[192.168.x.xx/24]
    gateway4:192.168.1.1
    nameservers:
      addresses:[192.168.1.1,8.8.8.8]

Anyway...if you have more expertise, which you do, than I, please contact me regarding this situation I have come across.

De Funct
  • 131

1 Answers1

2

There are several pieces that are needed to tie together a domain name or URL to a home IP address. As I am not certain about the specific environment in question, the following steps are somewhat generic.

1. Determine your public IP address

This can be acquired in many different ways, but I have found that the easiest is to visit a website from your home network that will do this for you. For example, cmyip.com will show this information (note that it is important to do this from the home network).

2. Link the public IP address and the domain name/URL

This step is heavily dependent on the company that the domain name was purchased from, but there should be instructions on site for doing this. At a high level, there should be a section referring to DNS settings where the IP address found in the previous step can be placed. This entry is called an "A record", which is a term that might be used on the site in this section.

3. Home Router Configurations

Now, the home router needs to be informed that incoming requests (someone else trying to access the website) need to be directed toward the server that has been setup. These steps are specific to the router; however, the general section that these settings will be under is typically referred to as "Port Forwarding". First access the router (it looks like its IP address is 192.168.1.1 from the config above). Then, there should be something called "destination" in the Port Forwarding section. The local IP address of the server should be put in this field. From the YAML config file above, this should probably be the 192.168.x.xx.

As a side note, I would definitely recommend the second configuration from above as that will prevent the server from changing this local IP address.

#blah
network:2
renderer: networkd
ethernets:
  enp0s3:
    dhcp4:no
    addresses:[192.168.x.xx/24]
    gateway4:192.168.1.1
    nameservers:
      addresses:[192.168.1.1,8.8.8.8]

Then, there should be a section for a port. Starting out, port 80 for an HTTP site (no security [aka SSL]) should be sufficient.

4. Getting the webpage up

In order to actually serve (display) a webpage from the ubuntu server, a web server is required. The question is tagged with both apache2 and nginx, both sufficient web servers for the task. There are many others, but those are the ones tagged in the question.

1. Install the web server

This step is relatively simple on ubuntu and only necessary if one is not already installed.

Nginx: apt-get install nginx

Apache: apt-get install apache2

2. Place website file in appropriate directory

The appropriate directory for nginx is /var/www/html, which is the same for apache2. Name the file index.html. Provided that everything is hooked up, the webpage should be displayed if the domain name is visited on a browser.

Summary

The steps above are relatively generic, but hopefully provide some general guidance. Specifics on each of the steps can be found through Google or other web searches. I wish you the best.

  • Hello Tim...Seth here. I appreciate your ideas and this is what I have been trying endlessly. I will keep on it. I appreciate your fast response. Now, w/ the ideas marked in numerical order, I might have a fighting chance. – De Funct Apr 11 '19 at 22:24
  • 1
    Okay...so? I think I have it figured out. The .yaml file is for setting a static IP on my system (Ubuntu Server). I was going backwards and in the wrong direction. Thank you. – De Funct Apr 11 '19 at 22:27
  • No problem! if you provide some more information on your setup, I might be able to point you in the right direction. – Informagician Apr 11 '19 at 22:29
  • Okay...I will delve deeper into my set up and then reply. Thank you for allowing me to know this info. so far. – De Funct Apr 12 '19 at 01:07
  • 1
    Hello...I changed my .yaml file and got going finally. Hellish journey...yes. Worth it...double yes! – De Funct Apr 12 '19 at 03:02
  • Informagician...are you still wanting to help me on this issue? I am currently not seeing my site online outside of my network. Do you happen to know why? I can ask another question if need be... – De Funct Apr 22 '19 at 02:34
  • Sure, I would be happy to help, but I would probably need more information. If you can see the site with a local IP address (10.x.x.x, 172.16.x.x, 192.168.x.x), then port forwarding on the router might not be working. Try providing some details in another comment, and if it gets to be too big, asking another question might be best. – Informagician Apr 22 '19 at 17:02
  • Hello...I think I just need a public/static IP which I do not have yet. I tried the private IP but I think this may be the reason things are causing issues. – De Funct Apr 23 '19 at 12:46
  • The static private IP for the server can be set with the network configuration highlighted in the answer. A static public IP from your ISP can be expensive and is typically not necessary as they don't change your public IP often. The domain, however, should be linked to the public IP, and the router should be told to forward port 80 from the public IP to the private. – Informagician Apr 24 '19 at 13:08
  • Hello...I got my site up and running. I am using apache2 now. I have https and a funny look to it so far. I will keep trying to make subdomains available w/ https. Thank you. – De Funct Apr 25 '19 at 03:10