Quick and simple HTML5 page skeleton template

<!doctype html>
<html lang="en">
<head>
 <meta charset="utf-8">
 <title>Site Title</title>
 <meta name="description" content="Site Description">
 <meta name="author" content="Jeff Steinport">
 <link rel="stylesheet" href="css/styles.css?v=1.0">
</head>
<body>
 <script src="js/scripts.js"></script>
</body>
</html> 

Limit WordPress admin access by IP address in nginx

As soon as any server is set up on the net, it will immediately see attempts at loading the /wp-login.php page. If you actually have a WordPress site set up, you’ll quickly start receiving lots and lots of login attempts. You can stop this completely by limiting access to /wp-login.php and /wp-admin by IP address in nginx (and Debian/Ubuntu). It’s pretty simple. Here’s how:

In your site’s nginx server block, add an include for the wordpress IP address configuration (this separate config file is handy for multiple WordPress sites, if you have more than one WordPress site on your server).

server {
...
include /etc/nginx/snippets/wordpress.conf;
...
}

Create a file at /etc/nginx/snippets/wordpress.conf:

location = /wp-login.php {
include snippets/blockips.conf;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}
location = /wp-admin/ {
include snippets/blockips.conf;
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php7.2-fpm.sock;
}

Then create a file that will list the IP addresses that will be permitted to access your WordPress admin at /etc/nginx/snippets/blockips.conf:

allow 0.0.0.0; #description
allow 0.0.0.0; #description2
allow ffff:ffff:ffff; #description3
deny all;

This will allow the three IP addresses listed above (of course, replace with the IPs you’d like to allow) to access your WordPress admin page. Everything else will be denied. Add a little description to the end of each line in order to keep track of which IP addresses you’re adding.

Then restart nginx:

service nginx restart

And you’re good to go.

The first time you log in, WP might complain about cookies. Just try to log in again.

Nationwide transit usage dropped 2.0% in 2018

The December transit stats were finally posted this week from the Federal Transit Administration, so I updated the National Transit Database site and updated the code for annual ridership stats.

2018 Transit Ridership Continued its Decline

Nationwide, there were 9.85 billion transit rides in 2018, compared to 9.78 billion in 2017. This represents a 2.01% decline year-over-year. Peak ridership, according to National Transit Database data, was in 2014 at 10.48 billion rides. This means that ridership has dropped 8.4% since 2014. Ridership is basically where it was in 2005.

New Project: National Transit Database Visualization

I created a new site that helps visualize data from the National Transit Database, which historically has made its data very difficult to parse.

For a little background: all transit agencies which receive federal funding must report a certain amount of data to the Federal Transit Administration’s National Transit Database. The FTA publishes two series of data: first, a spreadsheet of monthly ridership data, which usually lags by about two months. This spreadsheet has limited financial, ridership, and vehicle data for the each agency’s fiscal year, usually about one-and-a-half to two years prior to the present date. Second, the full NTD, which reports a high level of data about each agency, spread out across about 20 excel spreadsheets. The full NTD for each year (2016 is the latest available) contains financial (operating and capital), ridership, fuel/energy usage, and vehicle data.

In the past, when comparing different modes of transit and their financial costs, it has taken a lot of time and effort to just parse the spreadsheets and find the data you need.

My own National Transit Database site, which went live this week, is a start in parsing that data and making it more available. It’s meant to be user-friendly and visually informative.

For instance, take a look at the page for the Interurban Transit Partnership (The Rapid), in Grand Rapids, Michigan. I created a chart that shows overall ridership across all modes of transit provided by The Rapid, as well as breakdowns for each mode.

Ridership on The Rapid

For each individual mode of transit (for instance, bus, bus rapid transit, demand-response, etc) there is a tab with financial data. This tab pulls from both the monthly ridership spreadsheet and the full NTD data for the latest fiscal year (in this instance, 2016). Included is ridership, the number of passenger miles, average trip length, total operating spending, total fares received, total depreciation, and a breakdown of the cost of providing each ride and the total amount of subsidy required to provide that ride.

For the depreciation number, I had to estimate the amount of depreciation attributed to each transit mode because for some reason the NTD spreadsheets don’t break down the depreciation amount on a per-mode basis. Oddly, that’s one of the few bits of data in the NTD that isn’t broken down by mode. You can review the depreciation data in the Operating Expense Reconciliation spreadsheet. Therefore, I estimated each mode’s share of depreciation by allocating the depreciation amount based on the number of trips each mode represents as a portion of the total number of trips provided by that transit agency. Adding depreciation gives a much more accurate picture of the cost of providing a service because that includes a fair cost of the capital portion of each mode’s cost. Simply referring to the operating cost per ride (as many transit agencies do, including the NTD) paints an inaccurate picture.

One important thing to note, when reviewing the data, is that overall public transit ridership seems to have begun a decline in 2014 for many, if not most, transit agencies. Randal O’Toole has been reporting on this trend over at his Antiplanner blog.

The final item I’d like to point out is the monthly ridership change data. Simply presenting raw monthly ridership numbers would be very noisy and not very helpful or informative. Instead, it’s helpful to see how ridership is changing over time, even though it has a lag of a couple of months.

I plan to add more features, such as combined UZA ridership numbers, much more financial data, energy usage data, capacity usage data, and more. Feel free to contact me if you have suggestions.