New on LowEndTalk? Please Register and read our Community Rules.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.
Tutorial for php site on 64mb debian 6?
pyropyro78
Member
I have a teamspeak server currently on my 128mb buyvm box and am wanting to put a small php site on it as well for a faction forum, i have around 64mb to play with. Anyone know of a tutorial out there? I can only find them for debian 5 and am unsure if those would really still apply or not. Sorry in advance if this sounds a little lame.
Comments
Just use the leb script on lowendbox.com runs at ~25 mb ram here
If the PHP site doesn't require MySQL, it's a lot easier.
apt-get install nginx php-fpm sqlite3
/me runs two moinmoin-based wikis on inceptionhosting's 64MB Xen.
agree @breton, grab yourself fluxbb if you want to run under 64mb
@joodle I will go check that out.
@MannDude Sadly it will need MySQL or brenton's sqlite idea
@brenton @Nexus have not even heard of fluxbb, I will check that out too
Thank you all for the advice
@pyropyro78, I am not affiliated with them at all, but check them out here, it's very lightweight and you can actually get this forum up with nginx and sql/etc with 35-40mb ram, Right in your alley Good luck!
from the VPS running freevps.us (MyBB forum):
47mb ram used excluding buffers/caches.
MySQL, PHP-FPM (with APC), nginx
@Nexus @dmmcintyre3 I will go with MyBB. Though I am new to nginx, i am normally an apache person. I have got the site working except for when anyone wants to use www. in front of the domain name, it does forward to the nginx server though. any ideas?
>
>
>
I am just assuming it is in my /etc/nginx/sites-enabled file
Well, under server I would just add this:
if ($host ~* ^www\.(.*)) { set $remove_www $1; rewrite ^(.*)$ http://$remove_www$1 permanent; }
If I understand you correctly? This will just forward it and remove the www.
(Not sure if vanilla ate my code format)
@Nexus That seemed to work thank you thank you. Now to start work on the site itself.
@pyropyro78 np, hopefully that gets you going
set $remove_www $1;
rewrite ^(.*)$ http://$remove_www$1 permanent;
}
http://wiki.nginx.org/IfIsEvil
A correct CNAME in the DNS for the www and
in the config file should work
For what it's worth, rewrite is one of the very few statements that it's perfectly safe to use inside if.
I know, but I'm using my solution and it works for me so there should be no need for an if-statement at all. I was just trying to say that you should avoid every 'if' unless you tried every other solution to no avail.
To avoid the performance hit of the if, nginx pitfalls recommends:
server { server_name www.domain.com; return 301 $scheme://domain.com$request_uri; } server { server_name domain.com; [...] }
I usually just use server_name .mydomain.com, it covers non-www, www, and I think all other subdomains
But it leaves you scatterred all over search engines with competing www and non-www results.
@patrokov has the right approach.
Use, minstall it'll get you down to 11 MB at idle on OpenVZ. You can also use my minAdmin script for managing the site. Most of the questions you ask here are implemented in minAdmin.
any minimal script using lighttpd and php-fpm?
it seems not many tutorials use lighttpd with php-fpm, why? they don't get along very well? or too hard to config?
eating many memory
This is my configuration, not sure good or not.
ps: Varnish as front end.
@budingyun, hehe.. I use varnish with Minstall, now it seems like my site is faster than before
I'm just using varnish and without any caching plugin. Already fast enough.
Which one do you refer to? lighttpd or php-fpm or the combination?
Whan I'm using Lighttpd + fastcgi, it uses more memory, but my site load faster.
In Nginx I use php-fpm, and also it load fast. If it's a busy site, maybe adding more active server would be nice. But if it's a low memory box, less server would be great.
If you use lighttpd + php-fpm, will your site load faster?
dunno...actually I never tried that combination...because most tutorials in my search result use lighpttpd with fastcgi...so I just follow them with that setup...but I got the impression (maybe wrong) that php-fpm is better/faster than factcgi and seems most nginx tutorials adopt php-fpm...so I just wonder why? lighttptd does not get along well with php-fpm?
@budingyun
If you're trying to squeeze every last ounce of performance out of your box, you should use return instead of rewrite unless you actually need the increased functionality rewrite. Return uses variable names, whereas rewrite uses regex expressions. The nginx documentation is rather sparse on how much difference there is, and I haven't found any benchmarks, but theoretically there's a difference.
Also, if there's ever a chance that you might use ssl, instead of http:// you should use $scheme.
Your document root should be in the server block, not the location block. That way, if you add new location blocks they are relative and if you'll never end up with a page doesn't exist, because you left a location without a root.
If your http block has an index section you don't need to repeat index in your server block, let alone the location block.
Thanks for the info, it look like i need to study nginx documentation more. (>_<) My current config i just follow from default.conf, but after i follow your instruction like your post above, seems redirection from www.domain.com to domain.com much faster now.
And one last caution (not specific to nginx), if you think there's ever a chance that you might want to reverse your www.domain.com and domain.com, don't use 301 redirects, because anyone who's ever visited your site will get an error, because their browser takes "permanent" redirects quite literally. They have to clear cache to get it to work.
Lowendscript from the LEB site works fine on Debian 6.
http://www.lowendbox.com/blog/yes-you-can-run-18-static-sites-on-a-64mb-link-1-vps/