Suggestions regarding plan, stack and some practices for a newb
Hello everyone, I recently decided to move away from shared hosting and step into waters of VPS. I have many doubts and things I'm not sure how to do. I have no experience in the fields of maintaining server of my own, but given the community DO has and number of helpful tutorials, I'm feeling really good about this. Ofc, I don't think I will make it without your help. Current website has in average 190k page views and 58k visits per month. No logged in users. - WHAT WILL SERVER BE USED FOR: This is a travel agency's site. They hired me to develop a custom CMS for them. Nothing too fancy, has galleries, guides (articles about destinations), and naturally offes (again articles). As you can guess, it sits on top of PHP and MySQL. At first, CMS would generate a page from DB, thus hitting a DB on each request with 5 to 10 queries. Since articles are not being changed on daily basis, I was suggested to generate a static page of each article and store it in some folder and then just include it (like some sort of cache). That way I would reduce 4-10 queries per page load ending up with 0-2 queries per page load. Is that a good trade/practice? I'm worried that time/speed I get by not hitting the DB might be eaten bi PHP including those files. Anyway, back to topic, there wouldn't be much image processing except occasional on the fly thumbnail creation. I'm using .htaccess to cache static content and redirect all other requests to router.php. It'll have shoutbox so each visitor will hit server every 3s (Speaking of that, would you rather use file to store shoutbox messages or DB, thus hit DB every 3s per visitor?). ATM I can't think of any more information that might be useful about application. I'll add if anything comes to my mind. - oh, I plan on using CloudFlare, although free plan. 1) So, which plan would you suggest me? I'm pretty sure Apache will eat 512MB RAM plan easily. Could I get away with 1GB ? 2) What stack do you recommend? LAMP or LEMP? And why? I'm aware that NGINX consumes less resources, but I keep stumbling upon "nginx is good for static content". What about dynamic? Why do I need FastCGI with NGINX and PHP? I know how to configure virtual hosts on Apache, but it looks confusing on NGINX. Also, as I pointed out, I'm relying on .htaccess, if I pick NGINX, I'll have to learn and translate rules. And setting default error pages in NGINX? I'm also aware that NGINX increases my chances to get away with 1GB :P 3) What OS do you recommend and why? Ubuntu, CentOS? 4) I don't have to explain why I am especially afraid of deploying application to self managed server. Security is really important or I'm in big trouble. What measures do I have to take after I install the stack? Or what else should I install to secure my http and mysql servers? Any suggestions how to optimize them as well? 5) What about server side caching? Do I need it? Does MySQL have it's own caching capabilities or do I have to install something? I'm aware that maintaining own mail server is not a good idea unless you're experienced, so I'll just use shared hosting for that. I know this is a lot of questions, and I will be very grateful on any kind of help. Pointing out to related tutorials is also very welcomed.