Question

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.


Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Thanks, Kamal, I appreciate it :)

<blockquote>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 ?</blockquote>Apache uses <strong>tons</strong> of memory, especially when there is a high amount of concurrent users. I would suggest going with nginx instead. <br><blockquote>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</blockquote><strong>but I keep stumbling upon “nginx is good for static content”.</strong>Nginx <em>is</em> good for static content, but not just for static content. It actually serves dynamic pages faster than Apache. <br><strong>Also, as I pointed out, I’m relying on .htaccess, if I pick NGINX, I’ll have to learn and translate rules. </strong>Check out <a href=“https://www.digitalocean.com/community/articles/how-to-migrate-from-an-apache-web-server-to-nginx-on-an-ubuntu-vps”>https://www.digitalocean.com/community/articles/how-to-migrate-from-an-apache-web-server-to-nginx-on-an-ubuntu-vps</a>. <br><blockquote>3) What OS do you recommend and why? Ubuntu, CentOS?</blockquote>I personally use Ubuntu Server. <br><blockquote>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?</blockquote>Check out <a href=“https://www.digitalocean.com/community/community_tags/security”>https://www.digitalocean.com/community/community_tags/security</a>. <br><blockquote>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?</blockquote>Try starting off without cache as to not overengineer it and see whether you actually <strong>need</strong> it or not. <br> <br>I hope that helps! :]

Hi, thanks for responding. I’m not interested in Wordpress, as my client has some “special” requirements regarding backend. Anyway, thanks for suggesting a plan and OS. <br> <br>Wish you all the best.