Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with OpenID
Advertise on LowEndTalk.com

In this Discussion

Tutorial for php site on 64mb debian 6?

Tutorial for php site on 64mb debian 6?

pyropyro78pyropyro78 Member
edited October 2012 in Help

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.

    vpsBoard.com - Now with over 450 members! A friendly community with active discussion. Come join us!

    IRC.FREENODE.NET #vpsBoard - Drop by and say, 'Hello'.
  • apt-get install nginx php-fpm sqlite3

    /me runs two moinmoin-based wikis on inceptionhosting's 64MB Xen.

    Thanked by 1bnmkl
  • agree @breton, grab yourself fluxbb if you want to run under 64mb

    D4jsp - Where virgins roam free
  • @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 =)

  • NexusNexus Member
    edited October 2012

    @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!

    D4jsp - Where virgins roam free
  • dmmcintyre3dmmcintyre3 Member
    edited October 2012

    from the VPS running freevps.us (MyBB forum):

    [root@italy2 ~]# free -m
                 total       used       free     shared    buffers     cached
    Mem:           243        139        104          0          7         84
    -/+ buffers/cache:         47        195
    Swap:         1023          0       1023

    47mb ram used excluding buffers/caches.

    MySQL, PHP-FPM (with APC), nginx

    FreeVPS.us - The oldest post to host VPS provider
  • pyropyro78pyropyro78 Member
    edited October 2012

    @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?

    server { listen 80; server_name IHIDMYSITENAME.com www.IHIDMYSITENAME.com;

               access_log /var/log/nginx/www.IHIDMYSITENAME.com.access_log;
               error_log /var/log/nginx/www.IHIDMYSITENAME.com.error_log noti$
    
               root /var/www/www.IHIDMYSITENAME.com/htdocs;
               index index.php index.htm index.html;
    
                 location ~ .php$ {
                 fastcgi_pass   127.0.0.1:9000;
                 fastcgi_index  index.php;
                 fastcgi_param  SCRIPT_FILENAME /var/www/www.IHIDMYSITENAME.com$fastcgi_script_name;
    
                 include fastcgi_params;
               }
      }
    

    I am just assuming it is in my /etc/nginx/sites-enabled file

  • NexusNexus Member
    edited October 2012

    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)

    D4jsp - Where virgins roam free
  • @Nexus That seemed to work =) thank you thank you. Now to start work on the site itself.

  • @pyropyro78 np, hopefully that gets you going

    D4jsp - Where virgins roam free
  • WunderbarWunderbar Member
    edited October 2012

    @Nexus said: 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.

    http://wiki.nginx.org/IfIsEvil

    A correct CNAME in the DNS for the www and

    server_name example.com www.example.com;

    in the config file should work

  • @Wunderbar said: http://wiki.nginx.org/IfIsEvil

    For what it's worth, rewrite is one of the very few statements that it's perfectly safe to use inside if.

  • WunderbarWunderbar Member
    edited October 2012

    @lbft said: @Wunderbar said: http://wiki.nginx.org/IfIsEvil

    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; [...] }

  • winstonwinston Member
    edited October 2012

    I usually just use server_name .mydomain.com, it covers non-www, www, and I think all other subdomains

  • @winston said: 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.

  • zserozsero Member
    edited October 2012

    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?

    A list of VPS Providers with their Data Center information: vpsdb.net

  • eating many memory

    www.erawanarifnugroho.com - powered by Prometeus XenBiz | Server Uptime status - powered by Prometeus Xen Pune
    I'm not working for any providers in here, all my comments just my own opinion.
  • budingyunbudingyun Member
    edited October 2012

    This is my configuration, not sure good or not.

    server {
        listen      8080;
        server_name www.domain.com;
        rewrite     ^ http://domain.com$request_uri?;
    }
    
    server {
        listen      8080;
        server_name domain.com;
    
        location / {
            root    /usr/share/nginx/domain.com/public;
            index   index.php;
        }
    }
    

    ps: Varnish as front end.

    Thanked by 1ErawanArifNugroho
  • @budingyun, hehe.. I use varnish with Minstall, now it seems like my site is faster than before

    www.erawanarifnugroho.com - powered by Prometeus XenBiz | Server Uptime status - powered by Prometeus Xen Pune
    I'm not working for any providers in here, all my comments just my own opinion.
  • @ErawanArifNugroho said: @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. :D

    Thanked by 1ErawanArifNugroho
  • @ErawanArifNugroho eating many memory

    Which one do you refer to? lighttpd or php-fpm or the combination?

    A list of VPS Providers with their Data Center information: vpsdb.net

  • 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?

    www.erawanarifnugroho.com - powered by Prometeus XenBiz | Server Uptime status - powered by Prometeus Xen Pune
    I'm not working for any providers in here, all my comments just my own opinion.
  • 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?

    A list of VPS Providers with their Data Center information: vpsdb.net

  • @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.

    Thanked by 1budingyun
  • @patrokov said: 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. :D

  • 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.

  • @John_R said: Lowendscript from the LEB site works fine on Debian 6.

    Did it still works?

    www.erawanarifnugroho.com - powered by Prometeus XenBiz | Server Uptime status - powered by Prometeus Xen Pune
    I'm not working for any providers in here, all my comments just my own opinion.
  • @patrokov said: 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.

    I'll never do that.

  • Yes, it works.

    There are a few things you will need to change manually, I posted them on the page linked above.

Sign In or Register to comment.