Recently I chanced upon installing phpMyAdmin on a Linux server running nginx as a backend and Varnish as a reverse proxy. I faced a few problems which took hours of googling to solve so here I am writing this article to make your life easier. This article assumes you already have a web server up and running along with PHP, MySQL and have configured Varnish as a reverse proxy. Most of the problems I faced are because I already had wordpress running on that server, so I had configured Varnish to accept cookies from ONLY “(wp-admin|wp-login)” URLs this turned out to be a disaster for phpMyAdmin even after I configured a “return(pass)” for its URL.Continue Reading…
Using the Apache Redirect directive
Redirecting to another URL and passing the correct HTTP headers is extremely useful from SEO point of view if you migrate your website/blog from one URL to another. Other than redirecting to URL you can also use the redirect directive to send certain HTTP status codes when a page is accessed. The Redirect directive can be used in both the httpd.conf file as well as .htaccess file.Continue Reading…
Redirect http to https using htaccess
Redirect your website from http://www.example.com to https://www.example.com using htaccess file in your Apache web server. It is crucial to collect financial and confidential information from a person through HTTP over SSL to make sure the transactions are secure. A customer cannot be asked to type https in front of the URL each your website is visited. So you can make sure they are automatically redirected to the HTTPS version of the website each time they visit the URL.Continue Reading…
Redirect non www to www
This article explains how to redirect your website from the non www url to the www url but editing the .htaccess file. This is necessary because search engines think that example.com and www.example.com are different websites. But since they both have the same content it might work negatively on the search engine ranking. So it is better to redirect example.com to www.example.com doing so this sends HTTP 301 status code when a search engine (or any user) accesses example.com. The 301 code says the non www domain has been “Moved Permanently” to the www domain. Before proceeding make sure the server has support for mod_rewrite.Continue Reading…
Password Protect directories using .htpasswd
Anything uploaded to the document root (www, htdocs, public_html folder) of your web server is visible to the public that is why its always recommended to store confidential information outside the document root. But if you want that information to be accessed by selected people then you need to put it in a directory inside the document root and password protect it. Even thought server side languages like PHP and ASP can be used to handle authentication it can be cumbersome. So the htaccess and htpasswd can be used to simplify the whole process and make your life easier. Lets go step-by-stepContinue Reading…
Setting a Timezone in PHP
Using the javascript date/time function is easy because its a client-side language so it displays your system time. But its not the same case with PHP. Since its a server-side language it displays the server’s time which can be irritating because you might have your server located in another country and you might live somewhere else. But changing the timezone is just a few clicks away and whats more, you can even set different timezones for different pages/directories.Continue Reading…