Hacker News new | past | comments | ask | show | jobs | submit login
How to run a Linux based home web server (stevehanov.ca)
54 points by RiderOfGiraffes on Aug 28, 2009 | hide | past | favorite | 25 comments



Slicehost has some good articles on configuring linux servers for various webservers/frameworks:

http://articles.slicehost.com/


I used to do this when I lived at home, with AT&T DSL. I ran a site for my friends for three or four years. I used http://freedns.afraid.org/ for dns hosting, and just had a cron script update my ip every 15 minutes. It worked great.

The only issue is upload speed, so any large files take forever to transfer and kill your internet speed for your family. I did fix this a bit by using the traffic shaping support you can compile into the Linux kernel.

EDIT: it should be noted that this is against the TOS for AT&T.


Include all your own CSS and Javascript in the same file as your HTML, so that only one page needs to be requested. During times of heavy load, 99.9% of your visitors only load a single page of your web site anyway, so it makes no sense to split things up into different files.

This is terrible advice. Your JS and CSS should be consolidated into single files for latency purposes, but including them in every HTML page is insane. The bandwidth costs for two extra connections are negligible. After that you are wasting bandwidth every single time someone would have have those files cached.

On the latency front, reducing the number of connections improves latency on the later connections (given the standard browser limit of two connections per domain). However cramming CSS and JS into the HTML file actually will increase latency as it has to process those before it can display the page. This is arguably a benefit in the case of CSS so your visitors don't see an unstyled page, but with JS it's definitely bad.


How is this hacker news? basic unix admin skills are a prerequisite for hacking.


Hackers don't come into the world fully formed. Some people are hackers by nature, but have not yet developed the skills or the knowledge. There need to be resources for them to tap into, and to help direct their otherwise potentially inefficient hacking.

Further, http://news.ycombinator.com is also inhabited by a lot of people with a stronger slant towards entrepreneurialism, people who might want to know about these sorts of technical issues when they plan strategies or make choices, but don't necessarily have the time to do the hacker thing and explore the world of home-based web sites for themselves.

I think it belongs, in part becuse I think HN isn't just for the existing, well-matured hacker, but also for the budding, developing hacker.



No problem. Hackers can be pretty good at working around their flaws.


I wonder, if I don't need hugh amount of bandwidth should I go for a home solution?. Is it worth the hassle of administrating my own machine for web-hosting vs paying a web hosting service? Hostgator has a plan for 5dls a month. My admin time, power consumption, etc costs less than 5dls a month?


First legal issues, then dollars…

If you are in the US at least, your contract you entered into with your ISP probably forbids you from running a home server.

Now dollars. Figure out how many watts your server uses. This is not the wattage of the power supply or the amperage on the power connector times 110. I measure mine with a Kill-a-watt. For a desktop PC of unassuming power it is probably something like 90 to 150 watts. As a quick rule of thumb, you are paying $1/year for each of those watts.

You would have to have a 60 watt PC to compete with Hostgator on dollars. The only PC I have ever had that falls under that is an Atom based machine.


Truly, I say unto thee, that this one hath not the heart of a hacker.

;)


Hehehe, one thing is having my own server (which I have, CUPS, LAMP, Samba) and another thing is using it outside my private home network.

Although I have LAMP and make my things locally I prefer to "outsource" my hosting to someone else.


There shouldn't be much to administer once you're done setting everything up. Worst case scenario (which was my case), you spend a day fiddling with the damn thing.

Then you stick it under your desk, and it purrs along forever.


There shouldn't be much to administer once you're done setting everything up. Worst case scenario (which was my case), you spend a day fiddling with the damn thing.

Then you stick it under your desk, and it purrs along forever.


I've been doing this for years. My home server is the dev machine. And changes go there first, once I'm happy with it (and the client approved it), I use source control to push out the changes to the production machines at a hosting company.

It's much faster to edit a file locally as opposed to over a network share (sshfs).


Obviously it's fun to run a server at home, sometimes. The question is whether or not there's something more fun. Or "better" for any definition of goodness you prefer.

http://en.wikipedia.org/wiki/Opportunity_cost

I, for one, remain fully satisfied with the time I spent installing Gentoo Linux.


The thing that concerns me more is the surface area into my home network.


One of the first things you should do is find out if your ISP blocks the incoming ports you need for whatever servers you want to run. Most do. Almost all prohibit usage of servers in their ToS unless you have a "business class" package. The other issue is simply how much upstream bandwidth you have and how reliable your internet connection is.

Running a server at home is great if you actually want to learn the ins and outs of administrating. I've always felt like there are three ways to administrate a server:

1) Just make it work. All sorts of problems lurking under the surface but it does basically what you need it to do until you find out one day something is broken and you have absolutely no clue how to fix it so you have an emergency Google session trying to figure out what a cryptic error message means.

2) Make it work well and follow some basic 'best practices' This is only as good as the HOWTO you're following. Definitely better than #1 but a much bigger hassle. Not as much of a hassle as..

3) Do it right. Learn the platform inside out. Fine tune everything. Develop rigid backup & maintenance policies. Keep current with security issues. Check your logs religiously. Maximize your uptime.

These are all perfectly valid approaches to it depending how important the server is but they all do include an element of hassle and upkeep versus paying someone a few bucks a month to do it for you.


"find out if your ISP blocks the incoming ports you need for whatever servers you want to run. Most do."

I've heard this a lot, but never encountered it and I've run servers off of DSL, Cable, hell, even off a Sprint Wireless Card...

EDIT: I've always been a relatively good boy with these servers, so that might explain it.


The thing is, what if you want to run something Hostgator doesn't offer. I didn't see Arc, or PLT Scheme, or even Java. From your own home server you can run whatever you want.


I used Hostgator several years ago. I vaguely recall them being agreeable to install additional software upon request, though I do not remember what I asked them to install.


Yes. It is much more time/cost efficient to host from a server farm these days.


It's nice to have a dev server at home though.

I recently put together a new machine - an MSI Wind (the cheap one, $160) + 2gb ram ($20) + a OCZ Vertex 32gb SSD ($100). It's quite nice, fast, silent, and consumes 25 watts at idle.


http://www.no-ip.com/ is a good way to go for DNS.


47 upvotes for a sudo apt-get article. Great.


The articles not that amazing I agree, but it started a fairly interesting discussion.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: