Redirect timewaster sites with 3 Chrome extensions

I have a lot of sites that by themselves, aren’t terrible for me. I won’t spend hours on Facebook or Buzzfeed or Twitter or Gawker or Huffington Post…but I have found myself spending hours on Facebook AND Buzzfeed AND Twitter AND Gawker AND Huffpo.

I looked at some helpful productivity extensions, and I like this combination:

1. New Tab Redirect automatically redirects all new tabs to my fitness website instead of showing me my most visited sites in Chrome, which was distracting and sometimes led to Facebooking where none was intended.

2. StayFocusd gives me a time limit for how much time in a day I can spend on a collection of timewaster sites. Here’s my list of sites on which I can only spend 10 COLLECTIVE minutes per day. Yes, this means I have to compose my tweets before I go sit on Hootsuite for an hour mindlessly clicking.

Remove aol.com
Remove buzzfeed.com
Remove cracked.com
Remove dorkly.com
Remove facebook.com
Remove gawker.com
Remove hootsuite.com
Remove huffingtonpost.com
Remove instagram.com
Remove nytimes.com
Remove reddit.com
Remove themuse.com
Remove toofab.com
Remove tumblr.com
Remove twitter.com
Remove zergnet.com

3. After StayFocusd ticks over for the day, trying to go to those sites lands me on a StayFocusd ad page. So, I use Switcheroo Redirector to selectively redirect any URL to another URL. I fed in the StayFocusd ad page and now when I try to mindlessly hit Facebook after the time limit is up for the day, I land on the NOAA astronomy page looking at a current picture of the sky.

Voila!

Apache Virtual Hosts with SNI and SSL on Ubuntu 12.04 in Rackspace

Here’s a little howto: I was having the devil of a time earlier today configuring an SSL cert for a site Lorraine and I are working on right now. My problem is that I’ve never configured an SSL cert before, and proceeded to jump right on in with a whole lot of enthusiasm and zero knowhow.

It turns out that because the site we’re working on is on a Rackspace cloud server, and we’re hosting several sites on the same server using Apache virtual hosts to configure http requests via hostname as opposed to IP address, there is some extra configuration to be done. Add to that the fact that we’re serving secure and insecure content at the same hostname, and you have a recipe for a headache. So, here’s the way I did it.

First, let me list the useful tutorials and links, and then I’ll post the config files and examples that worked.

The most useful: http://www.tc.umn.edu/~brams006/selfsign_ubuntu.html

http://en.wikipedia.org/wiki/Server_Name_Indication

http://en.gentoo-wiki.com/wiki/Apache2/SSL_and_Name_Based_Virtual_Hosts

http://httpd.apache.org/docs/2.2/mod/mod_ssl.html

http://www.sslshopper.com/article-most-common-openssl-commands.html

Read this to understand why you’re doing this and what a certificate is: http://httpd.apache.org/docs/2.2/ssl/ssl_intro.html

Pro tips:

  1. You don’t need to turn on the ”
    Listen 443″ switch in apache2.conf; that’s already on and enabled with mod_ssl, the Apache module that handles SSL.
  2. If you keep seeing people telling you to edit your ssl.conf, what they mean in Ubuntu is /etc/apache2/sites-available/default-ssl. There’s already the stub there.
  3. Generate a CSR easily and simply by pasting this into a bash shell: openssl req -out CSR.csr -new -newkey rsa:2048 -nodes -keyout privateKey.key
  4. You have to create a symbolic link between the default-ssl in sites-available and sites-enabled like this:
  5. sudo ln -s /etc/apache2/sites-available/default-ssl /etc/apache2/sites-enabled/000-default-ssl

Ok, now here’s the example default-ssl file:




ServerAdmin webmaster@localhost
DocumentRoot /path/to/your/website/root/
r

Options FollowSymLinks
AllowOverride None


Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all

ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all

ErrorLog ${APACHE_LOG_DIR}/error.log
LogLevel warn

CustomLog ${APACHE_LOG_DIR}/ssl_access.log combined

Alias /doc/ "/usr/share/doc/"

Options Indexes MultiViews FollowSymLinks
AllowOverride None
Order deny,allow
Deny from all
Allow from 127.0.0.0/255.0.0.0 ::1/128

SSLEngine on
SSLCertificateFile /path/to/cert
SSLCertificateKeyFile /path/to/key/generated/from/CSR
SSLCertificateChainFile /path/to/bundled/certs/
from/your/issuer


SSLOptions +StdEnvVars


SSLOptions +StdEnvVars

BrowserMatch "MSIE [2-6]" \
nokeepalive ssl-unclean-shutdown \
downgrade-1.0 force-response-1.0
BrowserMatch "MSIE [17-9]" ssl-unclean-shutdown



And here’s the trippy part: you actually don’t need to edit your current virtual host file (presuming you have it correctly configured to serve nonsecure content via port 80) which should be living in sites-available. I have the feeling that if I was trying to serve more than one secure site on this server that I’d need to configure a NameVirtualHost, but since I don’t, all requests on port 443 can just get shoved to the document root of the secured site. I’ll explore that later, I suppose.

How To Build A Ruby Server With RVM On Kubuntu 12.10

So I’m building a Ruby server right now for the first time. I’m going to list out here the resources I used as a skilled web dev to get this up and running right away. These links do assume that you know what you’re doing in the cloud, but if so, they’re the best way to get running fast.

http://guides.rubyonrails.org/getting_started.html
https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-ubuntu-12-04-lts-precise-pangolin-with-rvm
This is the best link: http://www.andrehonsberg.com/article/install-rvm-ubuntu-1204-linux-for-ruby-193

And here are the steps:
n
Update, upgrade, dist-upgrade
ufw default deny and add 80 and ssh port
apt-get install build-essential http://ambienbuy.net git-core curl
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) echo '[[ -s "/home/andre/.rvm/scripts/rvm" ]] && source "/home/andre/.rvm/scripts/rvm"' >> ~/.bashrc
source ~/.bashrc
sudo apt-get install libsqlite3-dev
rvm pkg install zlib
rvm reinstall $(rvm list strings | tr "\n" ',')
rvm reinstall 1.9.3 --with-openssl-dir=/usr/local
rvm all-gemsets do rvm gemset pristine
gem install sqlite3-ruby -- --with-sqlite3-dir=/usr/local/lib
rvm gemset create rails31
rvm gemset use rails31
rvm current
gem list
echo "gem: --no-rdoc --no-ri" > ~/.gemrc
rvm pkg install openssl
sudo apt-get install -y libssl-dev
rvm reinstall $(rvm list strings | tr "\n" ',')
rvm all-gemsets do rvm gemset pristine
gem install rails
bundle install
rails new NewProject -d sqlite3
echo "gem '
therubyracer'" >> Gemfile

HOWTO: set up a cloud server with WordPress at Rackspace

You’re probably here because you are finally at the point where you need root access to your web server so that you can install applications like MediaWiki or WordPress or Joomla or any other CMS. If you have a website that you want to move away from a hosted environment, this is how to set yourself up so that you control every aspect of your site.

    1. Create an account at Rackspace.com. Go to Cloud Servers and create a new server. If you need help with this, though it’s very self-explanatory and easy on their site, you can always chat with their 24-7 online chat support. Note the administrative password and the IP address of the server you have created.
    2. Open a bash terminal and SSH into your shiny new server. “ssh root@YOURSERVERSIPADDRESS”. Enter the password.
    3. Create a user for yourself. “useradd -m -s /bin/bash yourname” and create a password for yourself  “passwd yourname”.
    4. Enter “su
      yourname”. Now, you are logged in under your name and not as root.
    5. Enter the following:
      sudo apt-get update
      sudo apt-get upgrade
      sudo apt-get install tasksel
      sudo tasksel install lamp-server
      sudo apt-get install php-mail python-software-properties unzip
      sudo a2enmod rewrite
      sudo apt-get autoclean
      sudo apt-get autoremove
      mkdir /home/yourname/yourwebsitename
      mkdir /home/yourname/yourwebsitename/blog
      cd /home/yourname/yourwebsitename/blogsudo
      wget http://wordpress.org/latest.tar.gz
      sudo tar -zxvf latest.tar.gz .
    6. That has cleaned up your server and installed a web server as well as WordPress. Enter passwords for your MySQL database and record them.
    7. “sudo service apache2 restart” #You will get an error that local server has not been set up.
      echo “ServerName localhost” | sudo tee /etc/apache2/conf.d/$servername
      sudo service apache2 restart #Should be no error now
    8. r

    9. cd /etc/apache2/sites-available/
      sudo nano yourwebsitename
    10. Copy this with CTRL+SHIFT+V into the terminal:
    11. ServerAdmin webmaster@localhost
      ServerName www.yourwebsitename.com
      ServerAlias yourwebsitename.com *.yourwebsitename.com
      DocumentRoot /home/yourname/yourwebsitename/
      php_value upload_max_filesize 1M

      Options +FollowSymLinks
      AllowOverride All
      Order allow,deny
      allow from all

      Options Indexes FollowSymLinks MultiViews
      AllowOverride All
      Order allow,deny
      allow from all

      ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/

      AllowOverride None
      Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
      Order allow,deny
      Allow from all

      ErrorLog ${APACHE_LOG_DIR}/error.log

      # Possible values include: debug, info, notice, warn, error, crit,
      # alert, emerg.
      LogLevel warn

      CustomLog ${APACHE_LOG_DIR}/access.log combined

      Alias /doc/ “/usr/share/doc/”

      Options Indexes
      MultiViews FollowSymLinks
      AllowOverride None
      Order deny,allow
      Deny from all
      Allow from 127.0.0.0/255.0.0.0 ::1/128

       

       

    12. CTRL+X and save the file as yourwebsitename.com.
    13. cd /etc/apache2/sites-enabled/

sudo ln -s /etc/apache2/sites-available/yourwebsitename.com /etc/apache2/sites-enabled/yourwebsitename.com
sudo service apache2 restart

    1. Where have you created your domain name account? If it’s with GoDaddy, login to your GoDaddy account and click on Domain Manager. Click on the website name and enter the dashboard (or follow whatever practice your domain registrar uses to get to where you can edit the zone file). Click on “Edit Zone File”.
    2. Replace the IP address in the zone file with the IP address of your cloud server. Save the zone file.
    3. “nano /home/yourname/yourwebsitename/index.php” and copy this into the file.

/**
*
Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*//**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
define('WP_USE_THEMES', true);

/** Loads the WordPress Environment and Template */
require(‘./blog/wp-blog-header.php’);
?>;

  • In a few minutes, you should be able to enter your URL into any browser, and see the WordPress installation page. Install using the database name and password you’ve created in PHPMyAdmin or in command line for MySQL.
  • I recommend Elegant Themes to get a beautiful and professional look for your site instantly.

 

How to move WordPress sites between cloud servers using Ubuntu 11.10 and PHPMyAdmin

Here’s a quick howto:

I use Rackspace as my cloud service; I was moving a few sites from one server using Ubuntu 10.04 LTS (Lucid Lynx) to a new one using 11.10 (Oneiric Ocelot). I hit a few issues, so I thought I’d tell you how to export a WordPress site in its entirety and move it between two LAMP servers.

  1. Open a file manager on your local machine, and open both remote locations.
  2. Copy the root and all files of the site to your new server in the same location.
  3. Copy the sites-available virtual host file from /etc/apache2/sites-available/ directory to the same location on your new server.
  4. Create the symbolic link in sites-enabled by changing into /etc/apache2/sites-enabled/ and using this command: “sudo ln -s /etc/apache2/sites-available/yourhostfile yourhostfile”.
  5. Open PHPMyAdmin for your old server in a browser window. Login, and open the database for the site you want to move.
  6. Go to the Export tab. Assuming you’re using UTF-8 encoding (and that’s a very safe bet), all you have to do is ensure that the Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT box is checked under Structure, and that all options are highlighted in the Export box. Export the uncompressed database and save to a convenient location.
  7. Open PHPMyAdmin in your new server, login, and create a new database with the same name as the one you’re importing.
  8. Import the database you exported.
  9. Create a user on that database with the same name and password.
  10. Edit the DNS zone file for your site to point to the new IP address for your new server.
  11. SSH into your server, and use this command: “sudo service apache2 restart”.

Hit Ctrl+F5 once you think the DNS records will have propagated, and ensure it worked.