Just like the title said, this isn’t tutorial to use Nginx as proxy for Apache with cPanel control panel. This is just story about me using Nginx for that kind of purpose in my cPanel VPS. Okay so here’s the story.
About a week ago, i called my friend because i need him to create me an ftp and ssh account in our community VPS so i can do some test for this VPS provider. At the time i checked the site load, it is amazing that our community forum took less than 2 seconds on average for 50 user visit simultaneously. I’m curious about that so i checked the VPS configuration, and it turns out that the VPS using Nginx as webserver. Wow, i want to try Nginx too for my website, so i’m googling and find the tutorial to install Nginx. I was able to install Nginx and use Webmin for administation panel. It is running well and smooth in my VPS, but there is a problem with .htaccess. Nginx doesn’t support .htaccess like Apache or Litespeed, so i’m googling again to find the way to resolve this problem. Then i found how to convert .htaccess configuration for Nginx, and yes my single website which using WordPress is working.
Until that moment there is no problem, but another problem arise when i want to share my VPS to my community member and my friend. I know that some of them can resolve the problem with .htaccess, but there are another person who are only like what is it called end user. They have no experience to mod the .htaccess to Nginx mod_rewrite configuration. It’s been a few days that i was thinking how to resolve this problem. Then i’m chat with my friend in messenger, it’s just a usual talk, and in the middle of our chat he told me that there are now lots of web hosting provider combine Nginx and Apache in their web hosting. It runs two webserver in one server and can take advantage from both. Again i’m googling (it’s the free way to gain knowledge) to find the true story about this, and there are lots of people saying that Nginx as proxy will serve static file like html, images, css, etc. while Apache keep doing work for dynamic files and we can keep using .htaccess as most of script is need to work with it.
It sounds interesting, i can keep my VPS load low and keep share it with my community member. I have tried create new account in cPanel, install WordPress, check the .htaccess configuration, all works perfectly. Nginx’s vhost configuration is automatically creating new vhost each time i created new account. You only have to create new vhost configuration manually if you transfer the account from another cPanel account.
End of my story, i’m not going to write about the tutorial here, once again i’m telling you it is not the tutorial and you just googling it, thank you.