NGINX is an advanced web server that blows Apache away in a lot of performance metrics. However, Apache remains the standard in web hosting, so documentation for using applications like Moodle with NGINX are hard to find. Here’s how to setup NGINX to serve up Moodle using SSL encryption. This tutorial assumes you have installed Moodle. You might want to read this before starting if you aren’t familiar with using SSL certificates with NGINX.
First, get an SSL certificate. You can get a free one from StartSSL. Save the certificate and key to /etc/nginx/certs for this config to work.
You must have a properly functioning SSL certificate and key in /etc/nginx/certs.
Here’s the NGINX config for Moodle:
server {
# Redirects all http traffic to https
listen 80;
server_name example.com;
rewrite ^ https://$server_name$request_uri? permanent;
}
server {
server_name example.com;
root /path/to/moodle;
listen 443;
ssl on;
ssl_certificate /etc/nginx/certs/example.com.pem;
ssl_certificate_key /etc/nginx/certs/example.com.key;
keepalive_timeout 70;
access_log /var/log/nginx/example.com/access.log;
error_log /var/log/nginx/example.com/error.log;
index index.html index.htm index.php;
location = /favicon.ico {
log_not_found off;
access_log off;
}
location = /robots.txt {
allow all;
log_not_found off;
access_log off;
}
location / {
# First attempt to serve request as file, then
# as directory, then fall back to index.html
try_files $uri $uri/ /index.html;
}
location ~ \.php$ {
# Drop your PHP-CGI config here
}
}
You’ll need to add your own domain name, root directory, and PHP-CGI config. Linode has a tutorial on setting up PHP-FastCGI with NGINX if you need help with that.
Don’t enable “Use HTTPS for logins” in Settings -> Security -> HTTP security. This setting is for encrypting the login page only and it creates an infinite redirect loop for some reason with NGINX. You don’t need it anyway when the whole session is handled by HTTPS.
Edit these settings in /path/to/moodle/config.php like this:
Change ‘http’ to ‘https’ here:
$CFG->wwwroot = 'https://example.com';
Then add this setting to the file:
$CFG->sslproxy=true;
That’s it. You should have Moodle up and running on NGINX with every session handled by HTTPS. Don’t forget to Install an opcode cache for lightning fast PHP performance.
In my previous post I described a way to get Galleria’s Picasa plugin working within a Drupal node. Now I’ll show you how to get the History plugin working.
The Galleria History plugin adds permalinks to Galleria slideshow slides, which facilitates linking and sharing single images. Like the Picasa plugin, Drupal’s Galleria module doesn’t support it yet, but getting it working in Drupal is fairly simple actually. To add History to the previously described Picasa node, simply add this line somewhere among the scripts being called at the top:
<script src="/sites/all/libraries/galleria/plugins/history/galleria.history.min.js"></script>
Galleria will do the rest.
If you have created a standard Galleria gallery with Views, you can enable the History plugin by editing the View and adding the same code as a text area within the header. Be sure to use the “Full HTML” filter.
That’s it. You’ve now implemented the Galleria History plugin on Drupal.
Keep an eye on updates to the Drupal Galleria module. A new version may implement some of these features, in which case you’ll want to remove this code so the plugin isn’t called twice.
This all assumes that you have installed Drupal’s Galleria module and have the Galleria framework installed in sites/all/libraries/galleria.
Drupal 7 has an excellent module (Galleria) for integrating the beautiful Galleria JavaScript framework into Drupal without requiring any coding. The module works great and has Views integration–a major plus. However, the module doesn’t support Galleria plugins yet. I wanted to use the Galleria Picasa plugin for a photography website I’m developing to allow the site owner to manage his the galleries on his website with Picasa instead of wrestling with Drupal nodes.
Here’s what worked. This will do a search for the first 10 public images on Picasa with the text “galleria” in them, and display them using the ‘medium’ size filter in date posted ascending order. You can learn how to query a specific public album and do other things with Picasa on the plugin options page.
This is the body of a node that displays the gallery (Use the Full HTML filter):
<script src="/misc/jquery.js"></script>
<script src="/sites/all/libraries/galleria/galleria-1.2.6.min.js"></script>
<script src="/sites/all/libraries/galleria/plugins/picasa/galleria.picasa.min.js"></script>
<div id="galleria"></div>
<script>
Galleria.loadTheme('/sites/all/libraries/galleria/themes/classic/galleria.classic.min.js');
$('#galleria').galleria({
picasa: 'search:galleria',
picasaOptions: {
max: 10,
sort: 'date-posted-asc',
thumbSize: 'medium'
},
width: 960,
height: 500 }
);
</script>
Many Galleria examples include a jQuery script on Google’s servers, but Drupal comes with jQuery, so we don’t have to source Google for that. You do need the Galleria library in your /sites/all/libraries/ directory.
This probably works with the Galleria Drupal module disabled if you don’t need it for anything else.
I actually used the Folio theme instead of Classic, but it’s not included with a standard installation.
Next up I will try to get the Galleria History plugin working.
Well, this is awkward.
I thought Google+ was going to take the world by storm, replacing Facebook, WordPress, Tumblr, Twitter, and maybe even email itself. No such luck.
I thought Google+ could be used a blogging platform. While it does have permalinks to each post, there’s no easy way to browse older posts, there is no HTML support, and no dependable RSS solution. I suppose if they wanted it to replace Blogger, they’d have said as much. I also don’t like mixing my public and private content on the same service. That’s asking for trouble.
Google+ hasn’t even taken off as a social network really. Why use it when Facebook still has better features and a huge user-base? Outside of photo sharing, I’m losing faith that it will ever amount to much. Google understands engineering really well. People? Not so much.
So where does that leave me and my once in-a-couple-months blogging needs? WordPress is the ultimate blogging platform, but it’s a little intimidating. I feel like there is an unspoken understanding that if you are using WordPress, you are taking writing seriously. You are a serious, capital “B” Blogger, with a lot of interesting ideas and exceptional writing skills.
I am not taking writing seriously. At least not on my personal blog.
So, I’m right back at Tumblr where I started, and you know what? Tumblr is great! My posts can be as short and banal as I’d like, because that’s what Tumblr is for. Call it medium blogging (<- unashamed banality!). But I still get all the stuff I need: permalinks, RSS, HTML, and data portability.
Anyway, if Tumblr will have me back, barring the downtime issues of the past, I’m here to stay. No more chasing the latest fad when I’ve got everything I need right in front of me.
Tangent: Check out my new personal splash page at flavors.me/jimvajda with awesome Tumblr integration. I think I’ll be redirecting jimvajda.com to it soon.
I’ve decided to try out consolidating all my blogging, sharing, and communicating with Google+ a la Kevin Rose. That means no more separate blog, facebook account, Twitter account (keeping this for now), and hopefully a lot less email. You can follow me on Google+ or subscribe to an RSS feed of my public posts if you’d rather not signup.
Maybe I’ll come back. Google+ doesn’t offer the formatting options that Tumblr does, and posts are still not searchable (come on Google, really?). But so far I’ve embraced it which has caused me to neglect the other services I use, especially Tumblr.
Anyway, follow me there or update your RSS reader. I’m going to try to redirect jimvajda.com/rss to the new feed, but I would guess that some apps won’t like that. Use this Feedburner feed instead:
$189.99 at Walmart.
The Reds have hit rock bottom, and so has their former star, Pete Rose.
The fact that we’re here today to debate raising America’s debt limit is a sign of leadership failure. Leadership means ‘The buck stops here.’ Instead, Washington is shifting the burden of bad choices today onto the backs of our children and grandchildren. America has a debt problem and a failure of leadership. Americans deserve better. I therefore intend to oppose the effort to increase America’s debt limit.
One of Instapaper’s five leased servers was hosted at DigitalOne, a Swiss hosting company leasing blade servers from a Virginia datacenter. Early Tuesday morning, the FBI raided the datacenter to seize servers used by another DigitalOne customer for fraudulent “scareware” distribution, according…
Did you know that most of the “food” we eat in the US is illegal in the rest of the developed world? Why is it so hard to eat REAL FOOD?
Freedom is a light for which many men have died in darkness.
Photos of a possible wall cloud on the southern leading edge of the supercell as it passes south of Oxford, Ohio.
“Poverty is a more powerful influence on test scores than value added by teachers and schools.” University of Texas physics Prof. Michael Marden’s visualization of the correlation between low SAT scores, poverty, and race.
The rationalist imagines an imbecile-free society; the empiricist an imbecile-proof one, or, even better, a rationalist-proof one.
Because the Internet is so new we still don’t really understand what it is. We mistake it for a type of publishing or broadcasting, because that’s what we’re used to. So people complain that there’s a lot of rubbish online, or that it’s dominated by Americans, or that you can’t necessarily trust what you read on the web. Imagine trying to apply any of those criticisms to what you hear on the telephone. Of course you can’t ‘trust’ what people tell you on the web anymore than you can ‘trust’ what people tell you on megaphones, postcards or in restaurants. Working out the social politics of who you can trust and why is, quite literally, what a very large part of our brain has evolved to do. For some batty reason we turn off this natural scepticism when we see things in any medium which require a lot of work or resources to work in, or in which we can’t easily answer back – like newspapers, television or granite. Hence ‘carved in stone.’ What should concern us is not that we can’t take what we read on the internet on trust – of course you can’t, it’s just people talking – but that we ever got into the dangerous habit of believing what we read in the newspapers or saw on the TV – a mistake that no one who has met an actual journalist would ever make. One of the most important things you learn from the internet is that there is no ‘them’ out there. It’s just an awful lot of ‘us’.
A very prescient Douglas Adams piece from 1999. He is dearly missed.