You are not logged in.

#1 2018-02-22 20:27:59

mkkot
Member
From: Poland
Registered: 2009-12-20
Posts: 287

How to host few small sites on VPS

Hello all!

So I currently have some cheap hosting service with few low-traffic sites on it: 2 wordpresses, one hand-made http + php site, picture galery, picture upload, file upload, some static sites and I also plan to use WSGI Python applications in the future.

Recently I bought VPS service for different reason: I built there a VPN with pi-hole to filter advertisements on my phone. Now I'm thinking about moving those sites to my VPS. So, few small sites with various requirements: PHP, mod_rewrite support, WSGI.

What approach should I use? How the configuration should look like? Should I set up a separate server, best for each kind of site (for example gunicorn for python apps, Apaches for the rest)? Or maybe I should set up nginx as a proxy for few instances of lighthttpd? Another approach would be to set up single Apache or nginx to host all of them. What would be best and why? I have no experience in projecting architecture of such systems.

Last edited by mkkot (2018-02-22 20:29:00)

Offline

#2 2018-02-23 10:59:54

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 4,092

Re: How to host few small sites on VPS

nginx for routing and static data,  php-fmp for that php crud,  wsgi server of choise for python stuff. You can run all this on the single vps if this is just low traffic.


Evil #archlinux@libera.chat channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#3 2018-02-23 11:20:30

frostschutz
Member
Registered: 2013-11-15
Posts: 1,409

Re: How to host few small sites on VPS

usually for small sites, a single webserver is enough. for low traffic site it doesn't really matter if it's apache, nginx, lighttpd ... it depends what you are familiar with. what you are willing to learn. each of these has their own pitfalls. apache does rewrites, nginx does rewrites, lighttpd does rewirtes, but each has slightly different syntax for them.

it's easy to get php setup wrong with nginx, and perhaps lighttpd also. a lot of wiki / blog explain wrong setups. make sure php is not executed for arbitrary user uploads, such as user avatars if they are hosted on your site and not gravatar.

webserver should execute PHP for existing PHP files only.

Offline

#4 2018-02-23 13:31:11

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: How to host few small sites on VPS

frostschutz wrote:

for low traffic site it doesn't really matter if it's apache, nginx, lighttpd

Agreed.  A vast majority of the pros and cons of each of these only become relevant under high traffic conditions.  The one criteria that doesn't depend on traffic patterns is how easy/hard it will be to set up.  I have minimal experience with nginx, but for very simple sites it's definitely the easiest, but as soon as you throw in php and half of the things you mentioned, that may not be the case.

I'd say for your conditions Apache would likely be the easiest.  Perhaps mostly because of the readily available documentation, examples, and web-searchability.  Just follow the yellow-bricky wiki.


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#5 2018-02-23 21:35:02

Slithery
Administrator
From: Norfolk, UK
Registered: 2013-12-01
Posts: 5,776

Re: How to host few small sites on VPS

I pretty much completely agree with everything above. On my VPS I use nginx instead of Apache as I find the configuration simpler and it's what I'm used to. All of the PHP webapps that I use (nextcloud, roundcube, etc) have nginx configs listed in their documentation alongside Apache examples.

Most of my sites are either static or use php-fpm, for the couple that use different server technologies (node.js etc) I just spin up a server listening on localhost and then still use nginx to do the https termination and reverse-proxy it to the server instance. Now that LetsEncrypt exists it's trivial to set up properly signed certificates that auto-renew for all of your domains, it also simplifies my nginx config as all traffic hitting port 80 gets immediately permanently redirected to port 443, meaning ssl config can live in my main configuration instead of each of the site-specific configs.

https://bbs.archlinux.org/viewtopic.php … 7#p1741847

Whichever method you choose there are plenty of knowledgeable people here who can help you if you get stuck smile


No, it didn't "fix" anything. It just shifted the brokeness one space to the right. - jasonwryan
Closing -- for deletion; Banning -- for muppetry. - jasonwryan

aur - dotfiles

Offline

#6 2018-02-27 10:14:28

mkkot
Member
From: Poland
Registered: 2009-12-20
Posts: 287

Re: How to host few small sites on VPS

Thanks a lot for bunch of good advices. One more question: how do you do redundancy and do you do it at all? I mean, what happens if this apache/ngnix/whatever which is proxy/server for all those sites goes down?

Offline

#7 2018-02-27 11:22:36

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 29,449
Website

Re: How to host few small sites on VPS

That depends on what you mean by "goes down".  If you have a single server and it goes offline then your server is offline, there is no magic software that can do anything about that*.  If you want hardware redundancy, you need redundant hardware.

*There are steps you can take to ensure it comes back online promptly.  Some of this is handled at the service provider / hypervisor level: linode for example has the "Lassie" service which will quickly reboot any VPS that powers down.  Then just ensuring your services are enabled to start at boot, they should all come back online.

Last edited by Trilby (2018-02-27 11:25:14)


"UNIX is simple and coherent..." - Dennis Ritchie, "GNU's Not UNIX" -  Richard Stallman

Offline

#8 2018-02-27 14:04:41

Maniaxx
Member
Registered: 2014-05-14
Posts: 732

Re: How to host few small sites on VPS

What about security concepts (process isolation, resource limits, logging, intrusion detection, counter measures...)?


sys2064

Offline

Board footer

Powered by FluxBB