Command-line Tricks
I’m a fan of doing work in the terminal. These are the dozen or so one-liners that I keep around.
Nginx over Apache, as well as Postgres over MySQL, but that’s another post.
Nginx is gaining against IIS and Apache because it’s very good at being a web server and uses fewer resources to do its job. And serving PHP with Nginx is easy to do, too. While most guides use custom FastCGI spawners and scripts, serving PHP with Nginx can be done even quicker and easier with mostly apt-get
installed software.
Note: This was written for Ubuntu 12.04 and PHP 5.
I’m a fan of doing work in the terminal. These are the dozen or so one-liners that I keep around.
This is a guide roughly outlining how I would manually setup and configure a server after the first boot. I tend to go with Ubuntu LTS (long-term support). Ubuntu is a popular distribution with a lot of library support, and the LTS version is supported for a longer period of time than the current releases.
Mobile visitors shouldn’t have to hit your desktop web application just to be redirected to your mobile web application. You can use Nginx to handle the redirect before it spins up all the resources of your web application.
Where I work, our desktop application automatically redirects visitors on mobile devices to its mobile counterpart. It was initially handling the checking and redirecting in the Ruby on Rails application using an implementation that was like the one shown in Railscast Episode 199. However, we have since made the mobile website a separate application and put it on its own subdomain, so I wanted to move the redirection logic out of the main Rails app so mobile users never hit the desktop application.