Apache Tutorial
Set up a Ubuntu/Apache cloud-based server


Domain Optimization

_______________________________________________

Introductory Comments

In a world full of websites, you must learn to optimize any website you create. In the next menu item, I will provide you a sample website for you to load and test on Your-Domain. First, learn the following SEO items to get you introduced to the things you must do to stand out on the web.

_______________________________________________

Preparations

  • Open your server text file.
  • Open the PowerShell.

_______________________________________________

Update your working server text file

Add these lines to your server text file. Be sure to replace the IP and password where necessary.

######
ssh root@Your-IP
Your-Password
systemctl status sshd
######
systemctl status ufw.service 
apt update
apt list -->upgradable
apt upgrade     --> Sometimes you will be asked if services need to be restarted.
--> I always select OK.
apt dist-upgrade
apt autoremove
###
###
###  Domain Optimization
###
###
-->  SEO
-->  Fixing the IP Canonical Issue in Apache
nano /etc/apache2/sites-enabled/000-default.conf
RewriteEngine on 
RewriteCond %{HTTP_HOST} ^128.199.100.xxx 
RewriteRule (.*) https://your-domain.com$1 [R=301,L]
systemctl restart apache2
systemctl status apache2
-->  Add a Title Tag
-->  Add a Website Description
-->  Sample Head Element
-->  Header Tag
-->  Alt Tag
-->  Focus search engines to one entry point: <link rel="canonical" href="https://Your-Domain/">

After you have made the changes, save the file and let's go!

_______________________________________________

Check some server things

Login to your Ubuntu server with PowerShell. Then take a look at who is there.

systemctl status sshd

Check the firewall status. Remember, green is good:

systemctl status ufw.service

_______________________________________________

Update your Ubuntu server files

Go through the update sequence. Zero change is OK. Follow the commands below.

Recently, apt update has been deprecated. This means it will work right now but will not some time in the future. There is a solution to bypass this warning. You will still use the same command, apt update, but you will no longer get the warning. In the Ubuntu community, there is some controversy over how to do this. I will give you the easiest solution now. I will update this as the solution improves.

Enter this:

cd /etc/apt
cp trusted.gpg trusted.gpg.d
cd

Continue with the update:

apt update
apt list --upgradable
apt upgrade
apt dist-upgrade
apt autoremove

_______________________________________________

A D V E R T I S E M E N T

_______________________________________________

SEO

SEO. Search Engine Optimization. There is a lot behind optimizing your website so it can be found by the search engines. It's also important to make sure your website doesn't end up on 'blacklists' that will limit your exposure.

_______________________________________________

Fixing the IP Canonical Issue in Apache

One thing we can do is focus all attempts to access your web server to only one location. We are using the www subdomain as the main access point. We have redirected the naked domain to www. We have further strengthened the access by eliminating any non-SSL entry. The next thing we need to do is eliminate access by the IP. This is also called fixing the IP Canonical issue in Apache.

Open the 000-default.conf file.

nano /etc/apache2/sites-enabled/000-default.conf

Substitute Your-IP and Your-Domain in the following lines. At the end of the file just before the </VirtualHost> line, enter these lines of code:

RewriteEngine on 
RewriteCond %{HTTP_HOST} ^128.199.100.xxx 
RewriteRule (.*) https://your-domain.com$1 [R=301,L]

Save the file. Ctrl X, Y, Enter.

Restart the Apache2 server.

systemctl restart apache2
systemctl status apache2

Open a Nightly browser window and type just Your-IP into the address line. You should be redirected to your main entry point.

_______________________________________________

Add a Title Tag

Search engines want to know what your webpage is all about. You can help them by adding a detailed <title> tag in the HTML <head> element of your webpages. The <title> tag defines the title of the document. The title must be text-only, and it is shown in the browser's title bar or in the page's tab.

This is an example of the <title> tag:

<title>Domain Optimization</title>

You can see this for my SEO page in this windows tab above. The title tag should describe your websites purpose in a simple and clear fasion. Try to make the title as accurate and meaningful as possible, not very short but less than 50 characters long. Avoid just randomly placing words together.

_______________________________________________

Add a Website Description

Another important thing to add is a description of your website and what it is for. You add that in the <meta> tag.

You should write like you are selling your page and what it does. This is the time to not spare any necessary words. Make it focused on your goal. Do not duplicate it on another page in your website. Each should have a different description. Here's an example from my page:

<meta> name="description" content="Build a cloud-based Apache Web Server. This tutorial tells you how from start to finish. Includes installation of Apache2, PHP, MySQL, CERTBOT, phpMyAdmin, and a demo website.></meta>

_______________________________________________

Sample Head Element

I've thrown in three other tags usually inside the head element. One describes the character set this browser is using. Another one describes the link to the Cascading Style Sheet or CSS file. This file makes the text look and act well on your webpage. The third describes the link to the teenie-tiny icon you see next to the title in the tab at the top of the browser window. Hopefully, your webpage will have a special one as well. Put together in the <head> Element of the page, they look like this:

<head>

<title>Set Up Apache Cloud-based Server - Domain Optimization</title>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<meta name="description" content="Build a cloud-based Apache Web Server. This tutorial tells you how from start to finish. Includes installation of Apache2, PHP, MySQL, CERTBOT, phpMyAdmin, and a demo website. The tools to do the job are described, too. For beginners and on.">

<link rel="shortcut icon" href="images/favicon.ico" type="image/x-icon">

<link rel="stylesheet" type="text/css" href="css/style.css">

_______________________________________________

A D V E R T I S E M E N T

_______________________________________________

Header Tag

Another SEO item that you wouldn't think was is the <header> tag. These are the different subtitles within your webpage surrounded by <h1> tags. They can go (usually) as far as <h5> and set the size for the font used to display them. The Domain Optimization title above is a header tag. You will use header tags throughought your webpage.

_______________________________________________

Alt Tag

The next SEO item I want to touch on is the image <alt> tags. These are the tags integrated into the image data for images you post on your webpage. Normally, people leave them blank. But search engines look for these tags to add to the image data on the web. If you have a specific picture that helps describe your subject, having an alt tag may draw search engines to your website. That cannot hurt! Make sure the description you add is exact and pertinent to the subject of the image. The data after the word <alt> is the tag you seek. Here is an example of an image I use elsewhere on my website:

<img> src="images/phpadminscreen.jpg" width="470" height="315" alt="phpMyAdmin Login Screen">

_______________________________________________

Search Engine Entry Point

Wow. You'd think just typing Your-Domain name would be enough. But your index.php file causes search engines a bit of heartburn. You see, they think Your-Domain and Your-Domain/index.php are the same place. Search engines don't like duplicate data for the same website. And you probably have duplicate entry points for your website. The search engines treat this as TWO different websites! You may ask, "How did I do that?" And the answer would be, you probably didn't even know.

There is an easy way and a hard way to fix this. We will do the easy way. Simply place this line in the <head> element of your web pages:

<link rel="canonical" href="https://www.Your-Domain/">

In the future, you may have a single PHP file that provides the header info for all of the webpages on your website. If so, you just need to add the canonical line there, one time.

You can learn much more about SEO by searching the web for search engine optimization. That's it for SEO. Time to put a sample website up on your new domain.

Sample Website

_______________________________________________

COMMENTS - Domain Optimization


Leave a comment.
Moderator approval may be required before posting.


Total Views of this Page: 662

_______________________________________________

Rocket! Rocket! Rocket!

_______________________________________________

If You Like This:

PayPal Pixel

I may make affiliate fees from services you select on this website.
Thank you!
©1998-2024 RocketRanch


x
This website is using cookies.   More info. That's Fine
Welcome again, you previously approved our cookie policy.