11-18-2009, 09:08 AM | #1 (permalink) |
Husband of Seamaiden
Location: Nova Scotia
|
Installing and running my own web server
So I want to buy an old server (ebay has lots going cheaply), install Linux/Apache and host my own sites instead of paying someone else to host for me.
I've already got two books on actual use of the server, one on installing Linux and Apache and one on configuring the server for using PHP and mySql for running database web sites. I'm looking for practical guides on wiring, installing, connecting more than one server, etc. Is there some books which I can read to give me advice on actual hook up/internet protocols? Forget the why's and wherefore's which will inevitably follow such a plan from the more experienced members, just stick to the details.
__________________
I am a brother to dragons, and a companion to owls. - Job 30:29 1123, 6536, 5321 Last edited by Lucifer; 11-19-2009 at 01:18 AM.. |
11-18-2009, 10:00 AM | #2 (permalink) |
Paladin of the Palate
Location: Redneckville, NC
|
There are some major questions you need to be asked before setting this up.
What kind of site are you running? How much traffic do you think will be coming to the site and how much do you want? Are you hosting this out of your house? Do you have a secure network in order to let random people off the net into your personal network? Are you willing to upgrade your bandwidth in order to accommodate your site? Also, are you willing to buy the equipment to make your house network secure too? I usually recommend letting a company do this for you, as there are a lot of things they can do that you can not do in your house, unless you have the money. Most of the time it's better to pay godaddy.com $20 a month and not worry about have Port 80 open in your network. Now, if you want to learn PHP/mySQL and learn how to run Apache, then this is prefect for you. Run a server in your house to LEARN, then when you have the basics down, move your site to a bigger web host. This I can recommend doing.
__________________
Vice-President of the CinnamonGirl Fan Club - The Meat of the Zombiesquirrel and CinnamonGirl Sandwich Last edited by LordEden; 11-18-2009 at 10:02 AM.. |
11-18-2009, 10:02 AM | #3 (permalink) |
Darth Papa
Location: Yonder
|
If I were you, I'd just jump into this with Google as your guide. My experience has been that if I stick to fairly common hardware and software, then anything I come up against already has a solution out on a blog somewhere.
In this case, it's not that hard. I'd put Ubuntu on the machine, just because it's very common and issues are well understood and easy to resolve, and it's probably the most user-friendly distro available right now. The only thing to deal with that I can see from here is your connectivity. You're going to use commodity DSL or cable? Can you get a fixed IP from them? Anything in your terms of service about using their service for web hosting? Set up your switch to route requests on port 80 to your server. If you're doing SSL, then route port 443 there as well. Then, set up Apache, and use name-based virtual hosting to host multiple sites. You don't need a separate physical box for separate sites (unless your traffic justifies that, in which case, man up for some real hosting). Keeping it on a single server cuts down your network complexity drastically. Just make sure you implement a data backup strategy. EDIT: (Also what Eden said. I'm not going to advise you on security issues beyond saying: don't do this. But since you're going to ignore that anyway....) |
11-18-2009, 10:34 AM | #4 (permalink) |
WHEEEE! Whee! Whee! WHEEEE!
Location: Southern Illinois
|
I am curious about some of this as well, not because I have any intention of operating a server, but how the whole thing works, 'cuz I'm a tech moron.
What are you paying for by having a hosted website? Bandwidth? Storage? Support? How come some sites are much more expensive than others? And at what point does it become more cost effective to have your own server as opposed to having a site hosted? Talk to me like an idiot, because I am an idiot when it comes to these things.
__________________
AZIZ! LIGHT! |
11-18-2009, 11:20 AM | #5 (permalink) |
Husband of Seamaiden
Location: Nova Scotia
|
This is why I said ignore all the why's and wherefore's. I'm more interested in an intellectual and practical exercise than I am in setting up a server farm in my bedroom closet
__________________
I am a brother to dragons, and a companion to owls. - Job 30:29 1123, 6536, 5321 |
11-18-2009, 11:35 AM | #6 (permalink) |
Broken Arrow
Location: US
|
Fug, you're paying for all of that. When a RAID drive dies, you're paying to have it replaced, for instance.
Having your own is cost effective when it brings in zero cash. Like let's say you want your homepage to be some unique site that you can reach anywhere, that has all the links you want, and is password protected. You make that the default page in your browser on your laptop or whatever, and have protected access to it from anywhere in the world. You can get hosting for 10 bucks a month or less, so once you have people connecting to your stuff, it's worthwhile to rent space. That way you have very little maintenance, security is not too much of a concern and you don't have to worry about hardware dying. The prices are no different than any dept. store or different chain markets. It's up to the big wigs on what they want to charge. I host my sites through rented space. I used to host at home, however. One issue anyone hosting nowadays will run into is ISP port blocking and TOS violations. Most ISPs now block 80 and other common ports coming from your home. The nomemclature is like this, as example: IP: 4.4.4.4 www port is always: 80 The resulting socket (that is the term used for this result): 4.4.4.4:80 That socket is implied in http://4.4.4.4, which is why you never see http://4.4.4.4:80 Now let's explain DNS. That IP, which is just a bunch of numbers, no one will not remember for a specific site. If yahoo.com goes to 209.131.36.159, you are not going to remember that sequence to save your life. So, we assign a name. Domain Name Service handles this. The record is propagated from the SOA (start of authority) and spreads across the world through DNS servers. Once finished, anyone trying to visit yahoo.com will point to 209.131.36.159 automatically. Now when you visit these: http://209.131.36.159 http://209.131.36.159:80 http://yahoo.com http://yahoo.com:80 You get the same result. I'm running out of time, so post questions from this point and we'll answer them Oh and one more thing. I can't leave without posting this. IF you set up a home server, you MUST, yes, MUST, have 2 routers. Otherwise your internal LAN will be compromised. The question will be not if, but when. I can promise you, it WILL happen if you have them all on one network. Use the attachment in the next post as a guide. 2 x 40 dollar routers 1 webserver whatever PCs a little cabling free software (apache/unix/linux/etc are free). Apache can also be run on windows, and several all-in-one packages have been made just for this. Lookup WAMP, XAMPP and appserv.
__________________
We contend that for a nation to try to tax itself into prosperity is like a man standing in a bucket and trying to lift himself up by the handle. -Winston Churchill Last edited by Vigilante; 11-18-2009 at 11:49 AM.. |
11-18-2009, 11:36 AM | #7 (permalink) |
Young Crumudgeon
Location: Canada
|
Yeah, I'm not even sure where to start.
This is not something that will be likely to save you money. Anything other than a completely trivial amount of traffic will quickly saturate a residential cable/DSL connection. The major problem here is upload capacity, which isn't likely to be higher than 1mbps. You won't be able to server requests to more than a handful of users simultaneously -- any more than 6-8 people connected at once and it'll start slowing down and timing out. There's also the power consumption -- on a commercial-grade rack server, this is non-trivial. Of course, you can simply use a consumer-grade box for this and it'll work (see also: Google), but I'm not sure what kind of hardware you're looking at on ebay so I want to cover the options. Putting aside the why's and wherefore's, as requested, the actual mechanics of it are pretty straightforward. Set up a box, connect it to your network. Install Linux -- Ubuntu is as good a place as any to start, although you'll probably want to move to Slackware or something similar eventually. You'll do most of your configuration and maintenance via SSH, so you won't need a separate desk/keyboard/mouse/monitor for it. Once you've got Linux up and running, install Apache and you're good. The biggest problem is going to be the networking/routing. Ideally what you should be doing is getting a small subnet so that you have more than one IP available to you. That way you can avoid NAT in front of your server, and segregate the server from your home network. You can simply set up port forwarding on any residential router, but that's a bit of a hack. The ideal here would be a Cisco or similar router, plus an extra IP or two and probaly an hour or so configuring it (assuming you know what you're doing). To Fugly, different hosts have different costs for a variety of reasons. For one, level of support varies. Some hosts allow or disallow scripting, some hosts offer different levels of tech support, some hosts will even take care of registration for you. On top of that is something that is pervasive on the business side of computers and networking, which is the service level agreement. Under an SLA, a host or service provider is contractually obligated to provide a predetermined level of reliability. Consider that even at 99% uptime, a server may be down for over 80 hours over the course of a year -- if that server represents your income, it's a big deal. The biggest providers offer 'five nines' SLA's (99.999% uptime), which requires a huge effort. Massive amounts of redundancy, multiple connections, multiple backups and the manpower as well. Those kinds of hosts cost a lot to use because the service costs a lot to offer. So the short version is, you get what you pay for. If your website is about your dog Rex, having that kind of reliability might not be important. If it's how you support yourself and your family, then it becomes a different matter. EDIT - You don't need separate hosting if you want a custom homepage. If you're really looking for that, you can just create the file on your desktop/laptop/whatever, and point your browser to it locally. There really is no practical reason to have your own webserver. It's cost effective for very large operations who would pay thousands or millions per year to third party hosts, but I doubt anyone on this site (or even the site itself) has sufficient traffic to make that the case. Also, that's not exactly how DNS works either. There is no one host (including the root name servers) that keeps track of every domain name in existence. If there were, simple updates would become a nightmare. The whole thing is broken up into zones of authority, generally referred to simply as zones. A domain name actually reads right to left in terms of zone, which is why the (usually three letter) bit at the end is known as the top level domain or TLD. There are currently 13 root nameservers, which serve as pretty much the hub of the DNS system (and by extension, the internet as most people know it). On every computer is a tool called a resolver. Whether you're running Mac, Linux, Windows or PalmOS on your cell phone, if it connects to the internet you have one. When you type a domain name into your browser, it gets handed off to the resolver, which goes to work. The resolver is essentially a pared down DNS server that's only able to make specific types of requests. It makes a non-recursive query to the name server specified when the network connection was established (usually via DHCP), which will then begin what's called a recursive query. A non-recursive query is one that say 'I need an IP for this address, and I don't want anything else.' A recursive query says 'I need an IP for this address, but if you don't have one please tell me who might.' The resolver will start at a root name server, with the TLD. When a domain name is registered, one of the things that occurs is that the IP address is added to the look-up table (known as a zone file) for the relevant TLD; thus, tfproject.org is registered with the .org root server. The root server will point the client towards the closest approximation. Sometimes it's the server in question, but often not. In this case, because my request was for www.tfproject.org, the root name server will point me (or my DNS server, more specifically) to the name server that's authoritative for the tfproject.org zone. That server, in turn, should know the address for the server responsible for www.tfproject.org. If there were a further subdomain (say, www.boobies.tfproject.org) then there could be further levels of recursion. DNS is enormously complex, and an issue all it's own, which is why I didn't initially touch it. If you want to run your own name server, you're going to be getting into a completely different can of worms.
__________________
I wake up in the morning more tired than before I slept I get through cryin' and I'm sadder than before I wept I get through thinkin' now, and the thoughts have left my head I get through speakin' and I can't remember, not a word that I said - Ben Harper, Show Me A Little Shame Last edited by Martian; 11-18-2009 at 11:55 AM.. |
11-18-2009, 03:19 PM | #9 (permalink) |
Mine is an evil laugh
Location: Sydney, Australia
|
Just wanted to add if you are looking to buy a rack mounted server, be aware not only of the power they suck, but also the noise and heat. You'll really need to think about Air Con running 24x7 with this kind of box running all the time. That is going to add hugely to the expense.
__________________
who hid my keyboard's PANIC button? |
11-18-2009, 05:04 PM | #10 (permalink) |
Husband of Seamaiden
Location: Nova Scotia
|
*****************************OKAY**********************************
let me re-iterate my original post (with helpful underlining for emphasis), please read it this time: So I want to buy an old server (ebay has lots going cheaply), install Linux/Apache and host my own sites instead of paying someone else to host for me. I've already got two books on actual use of the server, one on installing Linux and Apache and one on configuring the server for using PHP and mySql for running database web sites. I'm looking for practical guides on wiring, installing, connecting more than one server, etc. Is there some books which I can read to give me advice on actual hook up/internet protocols? Forget the why's and wherefore's which will inevitably follow such a plan from the more experienced members, just stick to the details.
__________________
I am a brother to dragons, and a companion to owls. - Job 30:29 1123, 6536, 5321 |
11-18-2009, 05:30 PM | #11 (permalink) |
Young Crumudgeon
Location: Canada
|
If you want guides for the various technology (software, mainly) that you'll need, the O'Reilly Books are generally considered to be authoritative. Be advised that these are technical reference manuals, with the jargon and price tag to match.
As far as the actual hardware setup goes, I don't know of a specific guide for that, though I can direct you to a few rather pricey courses. What we're trying to impress on you (among other things) is that this is not amateur stuff you're looking at here. If you want to go ahead, you can, but there's going to be a lot of seat-of-pants flying. Google will be your best friend for this project.
__________________
I wake up in the morning more tired than before I slept I get through cryin' and I'm sadder than before I wept I get through thinkin' now, and the thoughts have left my head I get through speakin' and I can't remember, not a word that I said - Ben Harper, Show Me A Little Shame |
11-18-2009, 06:25 PM | #12 (permalink) |
Paladin of the Palate
Location: Redneckville, NC
|
Martian most likely has the best knowledge of the board on this matter, I would listen to him on this. I've been in a house where my roommate decided to do the same thing you want to do. Our security was NOT up to the challenge of hosting a web server out of a trailer in the middle of the boonies. This guy in Brazil made out life a living hell for over 3 months till I got someone to come in and setup a PC to act as a firewall for our servers. He knew his shit (he works for Redhat's HQ here in NC now) and told us it was a bad idea to hook a local IP at our house.
***** You can ignore all of my above post if you like, I just need to restate that this is dangerous on a digital level. Call your ISP and get a fixed IP and the largest bandwidth package they have. You need alot of upload speed in order to do this. Get a cheap Watchguard Firebox and configure that for your network. That will help alot with traffic and help keep your house secure from the shit ton of people on the net that want to know what is on your computers. If you are willing to put money into this, buy one of those. Check ebay for them, brand new some of them are only a few hundred dollars. Also, get a good UPS, you don't want your shit crashing and having mass amounts of downtime because you got a power surge. You most likely are not going to find one page with all the info you need on this, you will have to go step by step and look up each of those steps one at a time. |
11-18-2009, 07:48 PM | #13 (permalink) |
Darth Papa
Location: Yonder
|
Well, it sounds like you've already got the plans all planned out, so that doesn't leave a lot of room for "answer"--probably because there's not much "question" here.
Here's my advice on wiring, installing, and connecting more than one server: Don't. It's not worth the headache. Apart from that, I don't see how I have anything to contribute beyond what's already been contributed, which doesn't seem to be what you want anyway. |
11-19-2009, 10:36 AM | #15 (permalink) |
Young Crumudgeon
Location: Canada
|
Okay. Well, it's the next day and my nerd rage has subsided a bit. I've decided to whip up a quick and dirty MS Paint diagram for you to give you an idea of what the network topology on something like this should look like.
What Vigilante has suggested is a bit of a hack; the problem is, as long as you're using a single IP for everything you're stuck using NAT and port forwarding. Aside from that, your home network is on the same address as the server, meaning that you're visible to the outside world and someone sufficiently savvy may be able to break into your network. Apart from all that, with his topology as illustrated above, you're going to be behind two layers of NAT. Double-NAT is bad and has the potential to break stuff. What you really want is something like this: The firewall is marked as optional, but it is strongly recommended. The reason that you could possibly get away without it is because the server box itself isn't likely to be overtaxed, so you could run a firewall directly on there. Also, depending on your routing solutions you might not need it -- a lot of routers these days have stateful firewalls built right in. Router 1 will have NAT disabled, and will instead route via IP. This is also why you're probably going to need a Cisco router -- so far as I'm aware, there are no consumer-grade routers that can handle a /30 subnet (although to be fair, I've never really tried to use one that way). IP 1 of your subnet will go to your HTTP server, while IP 2 will handle everything else and connect to your home network. You can stick any consumer-grade router on that port and it should do fine, although if you're going to invest the cash to do this I'd recommend a Linksys WRT310N, as they're quite nice. It should be noted that cofiguring a Cisco router aint like setting up your DLink jobbie. These things are very complex. You'll need to SSH in and actually know what you're doing. Seriously, people take courses just on this alone. With this setup it actually becomes fairly trivial to add additional servers to the network, although I can't imagine why you would want to. With the sort of connections available on residential services you're not likely to overtax the box even if you run HTTP, POP/IMAP, SMTP and FTP all on the same one. The other problem with this setup lies in the fact that most residential service providers in Canada will not lease you any kind of subnet. The exception I'm sure of is Teksavvy, but I seem to recall you being in Atlantic Canada and I don't know if they offer service out there. We've told you all the reasons this is a bad idea. All that's left to say is good luck to you sir.
__________________
I wake up in the morning more tired than before I slept I get through cryin' and I'm sadder than before I wept I get through thinkin' now, and the thoughts have left my head I get through speakin' and I can't remember, not a word that I said - Ben Harper, Show Me A Little Shame |
Tags |
installing, running, server, web |
|
|