Ads.txt Broken (https://linkprotect)

Ads.txt Broken KB ID 0001811

Problem

Here at PNL we had a problem with the sites ads.txt file recently. My ad vendor was telling me that it was being corrupted and my host was adding links that looked like I was behind a Barracuda. As I build the server from the ground up I knew this NOT to be the case.

Solution: Ads.txt Broken

The first thing I did was check the file I uploaded (from my LAPTOP before it was uploaded) and…

Which was exactly the same as when I checked the online version. So I was pretty sure I’d uploaded a broken one, I asked for a ‘known good working one‘ When the Engineer on the call said “Sometimes when these files are send via email a Barracuda will alter them”.

Penny Dropped

When I checked, I’d replied from my work email and the good folk at Newormedia had replied to that address, and indeed my coporate email  address is behind a Baracuda. I asked them to send the file to my personal address, and hey presto!

Here’s a before and after for clarity

Related Articles, References, Credits, or External Links

Massive shout out to Kawal at Newormedia!

Adsense Alternative?

KB ID 0001746

Way back in 2004 when PeteNetLive started, I didn’t even consider monetisation of the site, it was simply a place for me to store my personal scribblings about problems I’d faced in support. But as it grew and it had to move from a second hand PC under my desk, to a dedicated server, then a rented VPS. The cost began to raise. 

Back then there were a few ‘ad agencies’ but unless you were getting a LOT of traffic, they would not even let you though the door, but ANYONE could use Adsense, it was (and still is) the Advertising platform that Google provide.

How does Adsense Work: Simply you put some code in your web pages, then decide what ‘size’ you want those ads to be, you place the provided code where you want the ads to appear. Then once they’ve generated enough income (clicks) Google will send you the calculated profit for those.

Have we ever used any other Ad ‘Providers’? Yes, we’ve advertised directly for Vendors (Veeam was a great partner for many years, and it was only because I felt we ‘outgrew’ the relationship that we discontinued it this year). We also use ‘BuySellAds‘ who are also an alternative but take a larger slice of revenue for themselves and getting your money out of them is a manual process, that can take a few days. We have used MediaNet who just seemed to resell Adsense, and take a middleman cut, or put video adverts in, that adversely affected my site speed and performance.

Why Look at an to Adsense Alternative?

Well for me there were two reasons. My web traffic has gone up dramatically, but my income from the site hasn’t got up at the same speed, so I can only deduce Google are taking larger and larger slices, and doing not a great deal more to justify that commission. And secondly they are effectively the worlds biggest ad agency and they cant even sort out ad code compliance without expecting me to fix it for them. (If they’ve fixed that in the interim great, but it was the straw that broke the camels back for me.)

Newor Media (The best Adsense Alternative)

In Autumn of 2020, I got an email from Newor Media, asking if I’d be interested in using them, I get a massive amount of emails from ad networks, SEO experts, people wanting consultancy, etc. Ninety Nine percent of them just get ‘speed read’ and deleted, and so did the one from Newor Media, but they politely followed up and I replied. 

Why Use Newor Media?

Well they differ from other ad networks, insofar as they exist to get the best revenue for your ad space. They do this by auctioning ad units to potential advertisers, (including Adsense) and other advertisers who are not using Adsense/Adwords. Plus when I have a query or a problem I can email a ‘person’ who responds and is helpful, (Kudos to Katie!), and can escalate things, and get support directly. If you use Adsense your only helpline is usually ‘Other users of Adsense’ which is frustratingly terrible! So I agreed to give them a trial run.

Whats Involved / How Difficult Is It To Setup?

To be accepted, you need to meet certain traffic levels (those being, 30k unique users per month, with the large majority of those being English speaking e.g. en-us, en-gb etc). Once accepted they sent you an Insertion Order (If you’ve hosted ads with other companies this will be routine,) for the uninitiated its the legal agreement between you the site host and the supplier (Newor) so READ IT, then sign, date, and return it).

From there on, it’s pretty much the same as for Adsense, you add some code you your sites HEAD section, and they (Newor Media) will send you a small code ‘snippet’ to post into where you want the Ad to appear. (In my case thats a mixture of WordPress’Widgets’, and for the main content wherever I tell ‘Ad Inserter’ to put them! You will also need to maintain an ads.txt file on the root of your website (this is simply a text file that periodically you have to update (copy and paste) some text into).

How Much More Than Adsense Will You Make?

The 64 thousand dollar question 🙂 Well Adsense rules dictate you are not allowed to disclose what you are earning, so I can’t give you a direct comparison BUT what I can do, is demonstrate how much more you would be making with Newor Media.

The graph above shows a comparison of  BLUE Newor Media (Oct 20 to Mar 21) and GREY Adsense (Oct 19 to Mar 20). Bear in mind my YouTube earnings are included in the Adsense figures also!

Adsense Alternative: OK I’m sold, Where Do I Sign Up?

Providing you meet the 30k unique visitors a month (primarily English speaking) threshold. Note:   You can get this information from Google Analytics: (Audience > Active Users > 28 Day Active Users) and (Audience > Geo > Language). Then you can apply (Click the link below and tell them PeteNetLive sent you!)

Related Articles, References, Credits, or External Links

NA

Free Certificate for IIS with Let’s Encrypt

KB ID 0001736

Problem

I’ve been aware of Let’s Encrypt for a while, they are a non profit Certification Authority, who will provide you with a free certificate, and you can use them for most things you want to secure with a digital certificate. The only reason I’ve never used them in the past is, their certificates have a short (3 month) lifespan, and I see enough things breaking when people forget to renew 12 month certificates! This site went down a couple of years ago because the certificate expired while I was on holiday in Las Vegas, and is was a pain to get fixed!

I’ve got some work coming up that requires me to have a publicly signed certificate, so I thought I’d give it a whirl, it was incredibly easy and painless.

  • Server OS (Server 2019 Standard build 1809)
  • IIS Version 10.0.17763.1

Free Certificate Prerequisites

Obviously you need a Windows server, with the IIS role installed, and a website that you want to secure. It does not already need to have a certificate or have https configured, if you have or have not already done that it will all be reconfigured for you! In additional you need a publicly registered domain name, you’re on my website so you know I have one of those, and finally a DNS host record (A Record) that you will use to browse to the web server. The will be ‘stamped’ onto the certificate as the certificate common name (CN).

The website will need to be publicly accessible via TCP Port 443 (https) on the IP address you’ve set in public DNS.

To do all the heavy lifting you need a peice of software, the easiest (I’ve seen) is win-acme (at time of writing the latest version is 2.1.14.996) you simply download it as a zip file.

Extract the contents of that zip file to a folder on your hard drive.

Apply For & Install the Free Certificate

Open an administrative command prompt > Navigate to the folder you just created > run wacs.exe

Press ‘n‘ for create certificate.

I’ve only got one website, you may be hosting multiple sites, select the appropriate number.

I’m replacing every binding (you can have multiple bindings per site, but I’ve never seen that myself) > It then shows the bindings it finds > Select ‘A’ for all.

Yes to continue > No (unless you want the EULA to open in a web window for you to read) > Yes to agree to the terms (without reading them, shame on you!) > Enter a contact email address.

The software will go and get your certificate, install it, and bind it to your website. If it fails at this point it’s usually because the name for the certificate does not match your public DNS name, or the firewall is stopping your traffic.

Force IIS to Use Let’s Encrypt Free Certificate

To force client to use HTTPS and not HTTP, you will need to tick the option below (Require SSL);

If you take a look at your certificate you will see it’s got a three month lifespan, BUT, you dont have to worry about renewing it because…

Let’s Encrypt Free Certificate Auto Renewal

As well as getting your certificate, win-acme also created a scheduled task to check your certificate validity and renew it before it expires. Cool eh?

Where Does Win-ACME Store its information

Good question, it took me a little while to find that out, essentially once ran it creates a new folder in %programdata% (That’s a hidden folder on the C drive usually) called win-acme all your settings are in there, so if you make a mistake like entering the wrong email address, you can delete this folder and start again.

How To Remove Let’s Encrypt IIS Free Certificate & Settings

  1. Remove the certificate from IIS.
  2. Remove the win-acme folder from %Programdata%.
  3. Delete the scheduled update task from ‘Task Sheduler‘.

Related Articles, References, Credits, or External Links

NA

Adsense: ‘We’ve detected an error on your IAB TC string’

KB ID 0001709

Problem

A couple of weeks ago I logged into Adsense and saw this;

‘We’ve detected an error on your IAB TC string on one or more of your sites or apps. These errors may affect your ability to serve ads to European users. A detailed report is available for you on the EU user consent page’.

Solution

Well all of that made no sense to me, so I downloaded the report, which is a spreadsheet and it looked like this;

Erm OK, so what’s error 2.1a? well it’s this;

Everything I read didn’t make much sense, and a search of Google revealed a ton of things that made little or no sense to me.

Why Am I Seeing European IAM TC String Errors?

In short: People in Europe are protected by the GDPR. This says, (very basically) that website visitors should be ‘asked’ what their Ad preference, and tracking cookie preferences are, BEFORE the website can show them any ads, or attempt to embed tracking cookies, (like the ones Google uses), on their machines.

This is why you will notice most sites you go to now ask you about cookies and ads the fist time you visit,  you generally then tick a box that says ‘accept preferences‘, or ‘that’s fine‘, and you are bothered no more.

So that’s basically the root cause of the problem. Well I run my website on WordPress so “There will be a plugin for that right?” I tried a few and settled on UniConsent CMP. I installed it, and enabled cover for GDPR, (and CCPA compliance).

Note: Sign up for a free licence, then you can manage everything directly at UniConsent.

Extra Tip: Go To Consent Manager Version 2 > Manage > Fill everything in  > Enable GDPR (For European Countries) > Enable IAB TCF > Select Pop-up Box > Save and Exit (Top right).

Do You Cache Your Website? If so, don’t forget to ‘flush the caches’ at this point.

So That Fixed It Yes?

Sadly no, but because I now manage my CMP online they have a support/chat feature, and I was asked to do the following;

    1. A third party Ad agency I use has their own CMP I asked them to disable that, which they did, (don’t forget flush the caches again!)
    2. I had some embedded code with my Adsense ads that was calling this script;

[box]

script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js

[/box]

I had to remove each instance of that, and put the following code in my websites < HEAD > section; Download Code

Update (28 Oct 2020)

Well my errors came back, The good folks at UniConsent investigated and found out that I was caching, information (Javascript,) that was being called, and so breaking the TCF rules again. I logged a call to the people who provide my WordPress Caching Plugin (WP-Rocket.) Who remoted onto the server, and added the following onto their ‘File optimisation’ Settings;

The Adsense TCF Error Wont Go Away!

That’s because the errors stay on Google Adsense for 7 DAYS, even if you have fixed the errors, you need to wait 7 days for the errors to stop showing!

Which Ad Network Should You Replace Adsense With?

For everyone asking “What ad network did you move to”, then you can message me (link above) and I will let you know. There are some caveats, most of your traffic needs to be EN-US / EN-GB traffic, and you need to have a decent amount of traffic to be considered. If you fall into that category, message me and I will pass on you details to them. (Disclaimer: I get a financial kick back for doing so). 

Related Articles, References, Credits, or External Links

NA

NGINX: Redirect HTTP to HTTPS

KB ID 0001617

Problem

Rather by accident I discovered this was not working on the site. I know it used to work, but when the old certificate expired last year I was on holiday in The States, and had a panic trying to disable https, (to keep the site up until I got back and bought a new cert). So I’m guessing its been broken since then.

Solution

I spent about two days looking at forums about how to do this, and every time I edited the NGINX default file, the site stopped working. In the end I found one post in the middle of a discussion about this and that was the ONLY solution that worked for me.

Paste the following WITHIN your server block.

[box]

# Force HTTP to HTTPS Redirection (Entire Site)
if ($scheme != "https") {
    rewrite ^ https://$host$uri permanent;
}

[/box]

Related Articles, References, Credits, or External Links

NA

WordPress: Inserting ‘Anchor’ Links (Internal Hyperlinks)

KB ID 0001362

Problem

Back when I did the website in Dreamweaver, this was a simple task, there was an ‘insert anchor’ button*. If you have a long webpages and you want your readers to be able to ‘navigate’ around it using hyperlinks, then ‘anchors’ are for you.

*In WordPress there is still a GUI option, on the insert menu, so you can still ‘insert anchor’ (see below).

What’s an anchor? Its simply a piece of code in a webpage that lets you ‘jump to / hyperlink’ to it, so you can get there from within the same web page, or straight to a specific part of a page, from another webpage. (like this)

Solution: Insert Anchor 

Here I’m simply placing the anchor and nothing will be visible. If you are linking to a specific price of text you can use that as the anchor also;

Examples;

[box]Anchor with no text: <a id=”{anchor-name}”></a>

Anchor text: <a id=”{anchor-name}”>{test-to-display}</a>[/box]

To Enter via the ‘visual editor’ in WordPress

From the ‘insert menu’ choose ‘Anchor’ and supply a name.

How To Hyperlink to an ‘Anchor’

Normally when writing web pages/articles you will hyperlink to the URL of a web page, when linking to an anchor, the procedure is the same, but you supply the anchor on the ‘end’ of the URL and you specify it with a ‘#’ symbol. e.g. http://domain/page#anchor, but in WordPress you simply need to enter the anchor name and WordPress will understand that the link is within the same page.

like so;


Note: If the anchor is in ‘another’ web page, you will need to enter the full URL including the anchor text.

Related Articles, References, Credits, or External Links

NA

Microsoft IIS – Stop Getting Indexed By Search Engines

KB ID 0001352 

Problem

If you have a publicly facing website, and you DON’T want it indexed by the major search engines, then this is the post for you. Why would you want this? Well you  might have a development server that you don’t want appearing in peoples search results, or you might be hosting files and folders you want publicly available, but again you don’t want those files and folders showing in peoples Google/Bing search results.

Solution

From ‘Administrative Tools’ open ‘Internet Information Services (IIS) Manager’ > Select the Server > HTTP Response Headers.

Add  > Name = X-Robots-Tag > Value = noindex > OK.

Then from an administrative command window run ‘iisreset’.

Related Articles, References, Credits, or External Links

NA

WordPress – HTTP Error

KB ID 0001335 

Problem

Quite a few times after I rebuilt my server, (and WordPress site), I saw the following when uploading images etc.

HTTP Error

Solution

I was quite sure everything was setup OK, I had set the max file upload limits set, but it turns out I needed to add a ‘memory limit’ in my wp-config.php file before the error ceased. For completeness I’ll include the other usual suspects, in case yours is setup a little differently from mine.

Edit Your php.ini File

Note: If you are running an earlier version of php, your path may be different.

[box]

sudo nano /etc/php/7.0/fpm/php.ini

[/box]

Ensure the following has been set;

[box]

upload_max_filesize = 50M
max_file_uploads = 20
post_max_size = 50M

[/box]

Edit Your nginx.conf File

(Obviously don’t do this if you are running Apache!)

[box]

sudo nano /etc/nginx/nginx.conf

[/box]

In the very bottom of the http section, (before the end ‘curly’ bracket ‘}’), add in the following;

[box]

client_max_body_size 100m;

[/box]

Edit Your wp-config.php File

[box]

sudo nano /var/www/html/wp-config.php

[/box]

Add the following to the very bottom of the file;

[box]

define('WP_MEMORY_LIMIT', '120MB');

[/box]

Related Articles, References, Credits, or External Links

NA

Nginx Error – 413 Request Entity Too Large

KB ID 0001325 

Problem

A few weeks ago I did a series on setting up a new WordPress site, shortly after I had some problems uploading my caching plugin (wp-rocket). This was the error I got;

413 Request Entity Too Large
nginx/1.10.3 (Ubuntu)

Anyway, I fixed the error, and a few days later I got an email from someone with the same problem, so I thought this time I would document the fix.

 

Solution

Note: I’m going to raise the limits to 100Mb this might be far to large for you, 20 or 50Mb might be more sensible for most sites.

Firstly you need to make an entry in the nginx.conf file

[box]sudo nano /etc/nginx/nginx.conf[/box]

If you’re unused to working in these config files, you are looking for the http section, just before this sections ends (i.e. before the end curly bracket ‘}’), insert the following text.

[box]client_max_body_size 100M;[/box]

Exit and Save the file (ctrl+x, then ‘y’ {Enter}.

Restart nginx.

[box]sudo service nginx restart[/box]

You will also need to enter the new values in the php.ini file.

[box]sudo nano /etc/php/7.0/fpm/php.ini[/box]

Change the following values, like so;

upload_max_filesize = 100M
post_max_size = 100M

Exit and save the file, then restart PHP.

[box]sudo service php7.0-fpm restart[/box]

 

Related Articles, References, Credits, or External Links

WordPress – HTTP Error

Ubuntu: Setting Up a WordPress Website with LEMP – Part 3

KB ID 0001320 

Problem

So you want your own web server running WordPress? Previously in Parts One and Two, we setup a new Linux box, and got all the prerequisites installed. Now it’s time to deploy WordPress.

Solution

There are a few extra bits we need to add to the PHP installation before we setup WordPress, to get those installed run the following command;

[box]sudo apt-get install php-curl php-gd php-mbstring php-mcrypt php-xml php-xmlrpc[/box]

Then restart PHP;

[box]sudo systemctl restart php7.0-fpm[/box]

Download and Install WordPress.

We are going to use the /tmp directory and download wordpress into that, you don’t need to worry about what version to download because the good folk at WordPress use the same URL for the latest version and keep it updated.

[box]

cd /tmp
curl -O https://wordpress.org/latest.tar.gz

[/box]

If you didn’t already guess from the file extension, the WordPress files are compressed, we need to ‘extract’ them.

[box]tar xzvf latest.tar.gz[/box]

WordPress has a file called wp-config.php in the root of the website that we will be editing in a while, so we are going to create that file by using the ‘sample’ file provided.

[box]cp /tmp/wordpress/wp-config-sample.php /tmp/wordpress/wp-config.php[/box]

And, to save you hassle, (in future) we will pre-create the folder that WordPress will need when you eventually come to upgrade it, it will also, (after we have moved it in a minute),  have the correct permissions.

[box]mkdir /tmp/wordpress/wp-content/upgrade[/box]

Now we have all the files, but they are in the WRONG PLACE, they are all sat in the /tmp directory, but we want them in the root of your website, i.e. the  /var/www/html  directory. So to copy them (in bulk).

[box]sudo cp -a /tmp/wordpress/. /var/www/html[/box]

You won’t see anything happen, but if you have a look in your /var/www/html directory, the files will be there.

To set the correct permissions, execute the following commands;

[box]

sudo chown -R www-data /var/www/html
sudo find /var/www/html -type d -exec chmod g+s {} \;
sudo chmod g+w /var/www/html/wp-content
sudo chmod -R g+w /var/www/html/wp-content/themes
sudo chmod -R g+w /var/www/html/wp-content/plugins

[/box]

Configuring WordPress

Run the following, and it will return a large block of incomprehensible text; 

[box]curl -s https://api.wordpress.org/secret-key/1.1/salt/[/box]

COPY THAT TEXT TO THE CLIPBOARD (Yours will look different to the one above!)

Now edit the wp-config.php file, when its open go the the section that ‘looks like’ the text you copied above and paste your text over the top.

[box]nano /var/www/html/wp-config.php[/box]

While you are still in the file, you need to enter the database settings you setup in Part One. Near the top of the file you will see there’s a space for database name, username and password.

Enter your settings;

Save and close the file.

Now if you browse to your website, you should see the WordPress language selection, select your language and enter the settings and logon details for your website.

You will be logged into your sites admin panel (http://your-site/wp-admin). From here you can install new themes, add new plugins, and create new posts. Your website will now be ‘live’.

You may want to consider raising the maximum upload limit before proceeding;

Nginx Error – 413 Request Entity Too Large

If you are migrating data from another WordPress site into this one, see the following article;

Migrating WordPress From One Server To Another

If you are unsure on how to setup DNS records for your website see the following article;

Setting up the Correct DNS Records for your Web or Mail Server

Related Articles, References, Credits, or External Links

NA