Creating Cron Jobs in Windows 10 and Windows Server 2016

I recently made the switch from a Linux LAMP server to a Windows Server 2016.  It didn’t take me too long to figure out I forgot to transfer my cron jobs for my PHP pages. I went to start the transfer and I soon realized that Windows does not support cron jobs. However, I did find the Windows version of Cron jobs. Below is what I did to create these cron jobs so my PHP crons will continue run on schedule. This trick will really work in all versions of Windows, but you must get to it different methods.

Continue reading “Creating Cron Jobs in Windows 10 and Windows Server 2016”

How to start your own blog

When you are looking to start a blog of your own, it can seem like a daunting task. In reality, if you take it one step at a time and with the right instructions, you can easily create your own blog in just a couple minutes. The hardest part is choosing your website name and creating content. But if you are serious about it, in just a few minutes you can be on your way to creating your first blog post.

Step 1 – Choose a provider

The first thing you want to do is pick out a hosting provider. A hosting provider is who will actually store the files for the website and who will make it available for people on the internet.

I, myself, am a hosting provider, therefore I host my own sites. If you are interested in using me as your hosting provider, you can signup at https://axelwebhosting.com and use the coupon code “1STMONTHHALF” and you get your first month 50% off. This tutorial will show you how to setup a WordPress blog on my hosting platform using the WordPress easy installer. Continue reading “How to start your own blog”

Change Default SSH Port Number

SSH Command line

By default, SSH runs on port 22, and most scripts attack that port by brute force to attempt to gain access to your server. One way to stop script kiddies from brute forcing your SSH server so often is by changing the default port that OpenSSH uses. You must remember this port number and change all your connections that use SSH to the new port number. Continue reading “Change Default SSH Port Number”

Turn Windows Firewall Off or On By Command Line Or Script

I have run into a few times when I needed to turn off or on the Windows Firewall via command line or script. It is actually very simple to do!

To Turn Off:
NetSh Advfirewall set allprofiles state off

To Turn On:
NetSh Advfirewall set allrprofiles state on

To check the status of Windows Firewall:
Netsh Advfirewall show allprofiles

You can replace “allprofiles” with public, domain, or private and you can manipulate just that one profile. I used this in creating a script to test the firewall settings of a remote server. That way if I messed up the config, it would turn itself back off after a minute and I was able to reconnect to it. You can view that script on my other post Testing Windows Firewall Settings Safely From Remote Machine.

Testing Windows Firewall Settings Safely From Remote Machine

A while back I got me a new crisp Windows Server. By default, the Firewall was turned off and of course I wanted to turn it on for security reasons. But what happens if I lose my connection to a server a few hundred miles away? How would I disable the firewall if I can’t connect to it anymore? I decided to write a script!

The function of the script is to enable the firewall for the public internet, wait 2 minutes, then disable it again. Here is my script:

@echo off
Netsh Advfirewall set public state on
timeout 120
Netsh Advfirewall set public state off

Save those lines as a batch file, then run it as Administrator. Keep in mind to use this at your own risk! It saved me, but never know about you! An explanation of the commands can be found on my other post Turn Windows Firewall Off or On By Command Line Or Script.

DigitalOcean VPS Hosting Review

I have been using DigitalOcean for nearly 6 months now to host my websites and online services. They are a premium Virtual Private Hosting provider that offers many types of configurations in many geographic regions. In 55 seconds, you can have a VPS created and up and running with you ready to login and start hosting. DigitalOcean has many features to offer and they are always expanding on their features:

Continue reading “DigitalOcean VPS Hosting Review”

New Free SSL Certification Authority

Secutiry lock

I have been with my host for a couple years now. Their service use to be blazing fast but I have noticed over time they have began to slow down. Why am I still here? Because they offer free unlimited SSL certs. Yep – that’s the only reason.

I have come to find that there are many people at work, in the public, and other places constantly sniffing my internet traffic so I secure ALL my sites. However, a new dog is coming to play.  – the Internet Security Research Group (ISRG) is starting a free certificate authority known as Let’s Encrypt. With this new CA, they promise to be as secure as the big dogs, but offer automated scripts to secure your site and keep all certs up to date – automatically.

There has got to be a catch right? I mean where do they get their money from? They are getting backed by some of the world’s largest internet foundations such as Mozilla, Cisco, and Automattic, many others, and are accepting individual donations.

You can find their main homepage Here and they have created a community forum, which you can visit here. They are currently scheduled to release public sometime in the last quarter of 2015.

I am eagerly waiting – if you here of them opening up sooner let me know in the comment section below!

Links:

Your own IPSEC VPN in about 3 minutes using Digital Ocean

I have been wanting to setup my own IPSEC VPN for a while now to have a little bit of encryption from my network to the internet.  I found a good hosting provider for the VPN because it is so cheap ($5.00 a month) – Digital Ocean, then I realized that they only charge by the hour as long as you destroy the VPS. The VPN took about 30 minutes to setup. After a few times, I realized that I could turn this into a quick script. So now I can setup a VPS with a secure VPN in about two minutes, destroy it when I am done and only get charged a few pennies for having it. Here is how I do it. Please keep in mind that this has no warranty – if it melts down your server, sorry – but it hasn’t melted mine down yet!

Continue reading “Your own IPSEC VPN in about 3 minutes using Digital Ocean”

Change the default attachment link to setting

When setting up my blog, I was deciding on how to setup links in the attachment settings. I really don’t like pointing directly to the jpg file (which is the default) for a couple reasons. One, I cannot get an accurate reading of the analytics. Two, it does not get the pretty header and footer and links of my site. So I found the option to link to “Attachment Page”. I got to digging around, and there was no option to set the default link to! I found this:

There is a secret settings page in wordpress that allows you to change many settings that are not found in the regular wordpress setup. Point your browser to this address (of course replacing yourcooldomain.com with yours):

http://yourcooldomain.com/wp-admin/options.php

Once you are there, look for the option “image_default_link_type”. There are three possible values for this field (notice they are all lower case).

  • blank – leaving the field blank will default to the “none” setting
  • file – this links directly to the file. I do not like this because you are not able to perform any analytics or visual styling of the view.
  • post – I use this one. This shows a page with the usual header and footer with the image only in the center.

As you can guess, some of these options mis-configured can cause your site to crash, so be sure to use caution when editing these settings!

MySQL – Too many files open

I run my servers on CentOS using cPanel/WHM. When I first started running my own server, it did not take long for me to see how little I know about Linux. I had a funky problem with my MySQL dropping out after so much time. It seemed like the more people I had on my sites, the faster it would go down. But after I rebooted the server, it all started working fine again… For a while anyway.

I got to looking around to see if there is a error log for MySQL. And sure enough there is. By default, the error log is located at:

/var/lib/mysql/**HOSTNAME**.err

The **HOSTNAME** would be your server’s hostname, (if you do not know your hostname, simply use the command “hostname” and it will output your hostname)

To view the last 500 lines of your error log, simply use:

tail -500 /var/lib/mysql/**HOSTNAME**.err

In my error log, I began to see this:

130925 12:39:23 [ERROR] Error in accept: Too many open files
130925 12:43:39 [ERROR] Error in accept: Too many open files
130925 12:47:55 [ERROR] Error in accept: Too many open files
130925 12:52:11 [ERROR] Error in accept: Too many open files
130925 12:56:27 [ERROR] Error in accept: Too many open files
130925 13:00:43 [ERROR] Error in accept: Too many open files
130925 13:04:59 [ERROR] Error in accept: Too many open files
130925 13:09:15 [ERROR] Error in accept: Too many open files
130925 13:13:31 [ERROR] Error in accept: Too many open files
130925 13:17:47 [ERROR] Error in accept: Too many open files
130925 13:22:03 [ERROR] Error in accept: Too many open files
130925 13:26:19 [ERROR] Error in accept: Too many open files
130925 13:30:35 [ERROR] Error in accept: Too many open files

 

Did a little bit of googling, and discovered that by default, centOS has a hard limit of the amount of files that can be opened at a time, which causes MySQL to error out until you reboot the server. However, this can be fixed by running the doing the following:

nano /etc/sysctl.conf

Add this line at the bottom of the config file:

fs.file-max = 100000

 

Save and close the file, then reboot the server.

After you rebbot your server, you will want to run the following command to verify that your settings was saved and correct:

sysctl fs.file-max

If it reads 10000, then your server is now ready to handle MySQL!