This is HackerPublic Radio, my name is Clot2, and this is the networking basics mini series part eight. In this episode we're going to set up a web server, and we're going to do it internally, because already we've set up a gateway server, so we've got the internet going into that and going out to all of our clients on the network. We've got set up a DHCP server to actually give IP addresses to all of those clients, so that they can get to each other and get out to the internet and stuff that they've asked for on the internet and get back to them. And then the episode after that, which was this past episode, most immediate past episode in the series, we set up a DNS server with the fine Mara DNS server software, and we also mentioned DNS mask with a Q, which apparently is sort of an easier version of all that that uses the slash Etsy slash host file to sort of emulate DNS server, ittoed, and resolve domain names to IP addresses and so on. So in this episode we're going to just dive right into web server installation, which honestly after at this point, it's just going to be really simple, you're just going to, you're not even going to know it to do with yourself because it's basically practically one step, but of course we'll make it a little bit more interesting just because we can, but yeah, the server, the typical web server install, is, you know, something like, young install, Apache, or something like that, that's pretty much it, apt to get install Apache to, and then literally, quite literally, if you go to one of your client machines that you've got set up and you type in the address of that server, which is since we have internal DNS running, we can just do slackermedia.local, and suddenly you'll see the old, it works greeting. So on Devion, it's a, it works page, and it's white with black text, and it says it works on Fedora, you get a fancy, it really works page with lots of text and, like, explain a story like, here's why you're seeing this page. Don't panic, this is normal, you know, and you got the little Apache logo, so it's, it's that simple, it's just, it's done, it, it works, where to find it, almost invariably, you will find the slash, where you will find the, the folder that contains the stuff that people see when they go on to your website, which, of course, really is just a folder on your computer, right? Well, it's not in your home directory, by default, it's in slash of R, because you want people in your home directory, slash WWW, and if you look around in there, by default, at least on my, uh, Red Hat install, there's a CGI dash bin, there's an error folder, there's an HTML folder, and then there's an icons folder, they're got no clue what's in the icons folder, but if we go into the HTML folder, of course, we'll see the default stuff in there, which right now is nothing, um, in fact, I believe that it gets forwarded by default to use USR slash share slash, I don't know, um, something else, USR slash local slash share slash HTTP D, I think, um, something like that, and the point being that tooth tooth hole that, um, until you put stuff into that HTML folder, all you're going to see is a, it works thing, but that is where you want to put stuff slash far slash WWW slash HTML, and the other thing is that the generic name of the Apache, or the web server Damon is HTTP D, so on Red Hat, you don't service, you don't service Apache 2 start, you service HTTP D start, and that starts your web server. Now you can go to your website on a browser, I guess I kind of skipped over that step, um, on Debian, it would be slash Etsy slash init dot D slash Apache 2 start, so it's not called HTTP D, um, the name of the Damon is Apache 2 on Debian, and the users that Apache runs as are different on Red Hat systems versus Debian, I think on Debian, it's like WWW dash data or something, whereas on Red Hat, it's Apache, I think, so that's usually, I can quite honestly, that's about all there is on Slack, where it's slash Etsy slash RC dot D slash RC dot HTTP D start, and that starts the HTTP server, there's not a whole lot more to it, if you've ever been on a website, and you know how to make stuff appear than you're ready to go. You just see the end of slash far slash WWW slash HTML, and you can start making all the files that you want. Now, realistically, you might want to assign like a specific user to be your web dev user, so that all the stuff in there is being kind of managed by that one user. You might not, it really depends on how you want to do it. I made a group called the design group, and that's what all the web developers, all of them are members of that group, and so when they sign in, they all have permission to change all this stuff in slash of R slash WWW slash HTML. That is also where you'd put pre-made things like Drupal, and like a Drupal install, or a wiki media, or a tiki wiki wiki site, whatever, you dump it into your slash of R slash WWW to slash HTML on Red Hat, and then when you go to soccermedia.local in your web browser, or 192.168.1, port 80, of course, then that's where you're going to see everything. Now, of course, you can do a lot more than just that, and one of the things that you can do is, since we have that DNS server going on, we can make different domains exist on the same box, and one of those places, or the place to do that, would be the slash of R folder, and in slash of R slash WWW, you can make folders that are the different sites that you want to exist on the web server. Now, you can't just make the folders and have them be different sites that's not quite how it works, so that is something that you have to set in the web server that you're running. And, of course, it is important to note, since I nearly misspoke about it, anyway, that you can have different web servers running, or I mean, you can use a different web server. I'm using Apache, because that's the big one that I heard about, and I just kind of figured, well, that's a good place to start. But there are some really cool alternatives out there, like, in Gen X and LITPD, that you should check out, you know, and try to try running those, see if they're better, or easier, or faster, you know, whatever, whatever you want. Now, Apache is kind of nice, because this kind of one of those, everyone's going to support Apache, right? I mean, you're not going to find that you made a mistake by configuring Apache, you know, you're going to find pretty much that everyone, every pre-built site out there, like WordPress and Drupal and all the wiki's, and whatever you might want to install in this thing, they're going to have Apache support out of the box. So it's kind of the safe bet in that sense, but at the same time it is kind of, I guess, in a way, I don't want to say it's the easy way, but I mean, it is the one that, it's the most obvious one. So the place that you'd want to configure, where all the domains live and kind of what's called virtual hosting, will actually differ from deviant to Red Hat. It shouldn't really surprise you, but it will, in Red Hat, it is in slash Etsy slash HTTPD slash conf slash HTTP dot conf. I just put them down at the bottom of the, at the bottom of the file, because that's where there are little demo, or their sample text was, and, and the syntax is the same as Red Hat and deviant, deviant actually does this really nicely, and they, they split it up into sites that are enabled, and sites that are actually, or sites that are available, and sites that are actually enabled, it's, it's really quite nice actually, read up a little bit on that if you want, because it's some, to me, that's kind of the way that I think maybe everyone should do it, it's really quite nice, but anyway, in the Red Hat config, at slash Etsy slash whatever I said, HTTPD slash HTTPD conf, I think, they're down at the bottom, there's a commented outline that says use name-based virtual hosting, and under that it says name virtual host, space, asterisk, port 80. That simply says that, that Apache is going to be aware, if you uncommon that line, that configuration line, that Apache is going to be aware that there are more than one site living on this box, and that they're virtual sites, they're virtual websites, because traditionally speaking, I guess, a website was a server, but Apache came along and maybe displaced that notion with these virtual hosts, so there are virtual hosts of, it's just a pretty simple syntax for what I do, it's, and obviously you can find more complex configurations online, but it's just virtual host, well, less than symbol, virtual host, camel case with a capital V and H, space, asterisk, colon 80, greater than symbol, uh, next line, server name again, camel case with a capital S and N, space, WW dot, uh, slackermedia.local, next line, document route, camel case, capital D, uh, capital R, space, slash, var, slash, WW slash, HTML slash, WW dot, public source dot, local, and then the next line, you close the virtual host, so it's a little bit, you know, XML, so you do less than slash virtual host, camel case, uh, greater than, and that closes that, that block. So you duplicate that block as many times as you want, pointing each server name to a different directory within your, um, within your, within your server. It's, it's done the same way on Debian, it's just a different file, and then you can place the configurations for each of those websites in either server enabled, well, I mean, yeah, site enabled or site available, and you can move that file from one to the other to turn the site on or off. It's, it's really, really neat and, and quite effective. Um, I've not really done anything too fancy on Red Hat so far in terms of, of having multiple sites on on one main box, but it, it is something that, uh, Apache apparently, you know, does really well. So I don't know how other web servers handle that. I'm sure they do. I just don't know how, but that is how you do it. Um, I don't know if we started the server yet, I think we did, right? So it would be slash, well, it would be service, HTTPD start on, on, on Red Hat, or it would be, slash Etsy slash in it dot d Apache to start on, on Debian. And if you had just changed a setting, you would want to usually restart that service. You wouldn't want to restart your computer, obviously. You just do service, HTTPD restart or Etsy in it d, Apache to restart, and that will restart. A lot of times if you're restarting a service and it fails to restart, it means that you've done some typo in the configuration file that you've just changed and you need to go back and it's probably, you know, a misplaced greater than symbol or a forgotten semicolon or whatever. So the, I guess some of the really common associated services that people find themselves installing with, with Apache for instance, would be for instance, mySQL server. MySQL server is a lot, like in terms of simplicity and configuration and stuff. I equate it in my mind to SSH because you simply install, you know, you do an app to get install mySQL dash server and it grabs all the associated packages with a mySQL database installation that will then serve databases to various things, including your own Apache server. The reason I'm mentioning this, one reason is because it's usually famous. I mean, the lamp stack. It's Linux Apache mySQL and PHP. So if you're doing this, this is like a very common kind of activity. And of course, I mean, any kind of internal site that you're going to install, like a droopler, wordpress or whatever, they're going to require mySQL install or they're going to want something similar, like a postgres or something like that, or MariaDB if you want to stay away from mySQL. So whatever you can get a hold of database server, that's a pretty simple install. You would, again, just remember to start the service, which I typically in real life, I remember to do it. I just keep forgetting to mention it on the show, but you do the slash at CE slash RCD or in it D rather on devion, in it dot D slash mySQL D start or on red hat would be service mySQL D start, whatever. So that gives you is a running idling mySQL server that you can then do cool stuff with, like mySQL admin, create some users or a user and then create a database table and then marry that database table to your droople install or your wordpress install or your copper mine photo gallery install. You know, whatever you're doing with that server, that little local install, you can you'll have mySQL running on local host. So if you ever configured one of these through a web host company, they usually have their mySQL servers running on some other box, you know, somewhere else in their data center or whatever. And so you're usually putting in on your droople configuration when you're going through that, you're putting in some random string of numbers and letters and then it's, you know, that's some other server and then there's your user name and your password and the database name and the database user and the database password, all that other stuff same deal here except that it's not going to be some weird database on some other server, it's going to be the database running on that very server. So it's a local host. It's really nice is very simple to set up and don't forget your mySQL password. Obviously there are lots of other kinds of servers that you can set up at this point. I mean right now what you've got is a server that is the the the the center of your local network. So you can do all kinds of cool stuff. You can either install more stuff onto that box if it's nice and powerful and you feel really confident about performance or you can set up another box next to it and put, you know, like a jabber, jabber server on that and an MPD server and you can just run all kinds of cool services on these things, point at it from your DNS records and sign it at DH and static IP address with DHCP and suddenly you've got people chatting on your own internal fully encrypted jabber service while writing wiki entries on your internal wiki while listening to music via your NPD server and it's just really cool. It's it's amazing stuff. So if you haven't done this before and you have if you haven't been following along frantically with all of these episodes, you should you should do that. You should set one up if you can possibly swing that. I mean I know it requires really to to work the way that I'm describing it. It does require hardware with you know multiple network cards and and a switch and all these other things. But you know that's it's kind of worth it if you can get a hold of all that stuff. And even if you can't you might as well try it with you know either two laptops to whatever degree you can or you could try it with with a laptop you know with one network card being the ethernet cable and the the one that distributes out the information your wireless card or you could try it with virtual machines as well. I've never tried it with virtual machines so I can't really advise you on that. What I can advise you on is the the role of routers in in this whole set up that you've got. So I don't know about you. I don't have switches lying around. Well now I actually do I lied but but back before I got a job where there were switches involved I didn't have switches just lying around. I had like a little router from best buyer whatever and it wasn't actually from best buy but you get the idea it was like one of those little cheap plastic routers and that's kind of what I used and and that was that and that that little router actually was the gateway server and it was the DHCP server. I think some of the fans to your routers kind of have a little tiny DNS server in there. I don't really remember I remember doing a lot of Etsy host stuff so maybe the routers didn't but I bet you can find some with that feature but the the thing about the router now is that it might be handy but you want to turn off a lot of those features because if you think about what it wants to do it wants to do all the things that you've just set up. So if you if you set up a gateway and you set up DHCP and and all that stuff not you know network address translation the whole nine yards you've got running now on your computer you don't need the little plastic router that you got from eBay to try to manage all of that for you you actually don't want to do that because then you're going to have all kinds of interesting network problems that you know everything thinks something else is a different server or it's going through one router only to get to another router essentially so it's a lot of wasted traffic there so make sure that if you're using a router kind of dumb it down so that it's more like just a switch more or less it basically a true router that you know it doesn't actually serve DHCP it's a feature that it does that it really is like when you need your router to just work and magically propagate all these IP addresses for you stuff like that it's a feature but in this case since we've kind of overridden that it would it would become a little bit of a bother so I hope that this these three episodes in the networking basics series have been informative I will have more I'm sure at a later date but this is about as much as I've got before you right now so I hope you enjoy them and I hope that you have fun flying around with servers and good luck with them you have been listening to Hector Public Radio at Hector Public Radio does our we are a community podcast network the release of shows every week day one day for Friday today show like all our shows was contributed by an HPR listener like yourself if you ever consider recording a podcast then visit our website to find out how easy it really is Hector Public Radio is founded by the digital dot pound and the economic and computer club HPR is funded by the binary revolution at binref.com all binref projects across response of my linear pages from shared hosting to custom private clouds go to lunar pages that come for all your hosting needs on list other ice stages today show is released on the creative comments attribution share and like details of life