How to Set Up Nginx Multi-Site Virtual Hosts
Hey, Olly Connelly here. In this tutorial I'm going to show you how the set up multiple sites and blogs using virtual host and the super sexy engines web server. This is part 13 on the set up and the manage VPS the newbie’s the VPS Bible which takes your virtual private server from zero to here and here's the index 20 parts. You can use it than more than the passion or you can use the whole damn thing.
And then in this particular part you can see a company notes well how you bit more detail on the website. And it’s very, very handy indeed for copying a lot of code and it much easier than stuff starting the video all the time. Okay, so let's crack on into that command line interface.
We’re going to create direct first of all which is we are all the websites again to reside and that called Public_html. And so that you can visualize that in your FTP client if I open up my site we've got Linux directly structure down here and there's the home directory. And in there I just got one folder which my user name Guvnr. And so the public_html folder is also going to go in here with all of my websites and blogs in there.
So there we go and in there I'm going to pop in another folder which is go way waywiderweb.com one of my domain and in there I'm going to add another four directories. And so let's go to that to FileZilla and refresh it and then we go. There's a publication in that folder that we created and inside there is the first of my domain and inside there I've got this four folders, okay.
Now, the key one is the public one in there that’s where your website folders and files are going to go, all right. All of it is in there that’s your roots to your website, so now the set up users and permissions and groups and so I'm going to assume super user permission to do this. Let's get that right, I'm going to add a group called Webmasters when that done I'm going to modify user which is me Guvnr to add myself to the Webmaster’s group and you can do that for as many users as you need adding them to webmasters.
If you don’t know how to web users by the way we did that in—what was it thoughtful there, create a Linux users and set permission explain just how to do that. And on to permissions and what I want to do is I want to mod the user Guvnr and the group Webmasters to basically rule over that folder the public_html folder. And so that’s well then does together with that.
And this line of code here is for future proofing so basically any files of folders created in the future are going to belong to that group and to Guvnr in this case. And log out in the root, now what we’re doing here we’re going to create a test homepage for the first new domain, creating at using the Nano things editor but you could FTP not a file if you prepare so that’s going in this new public_html folder and that leave at that in the roots folder public and it’s going to be code index HTML. I'll paste in a little bit of HTML and I'll save that and of course you repeat for as many domain as you want to put up on the web and that’s all pretty straight forward.
Okay, so we're going to create the virtual host files and the assembling now. Now you’ve got one of each of those for domain the assembling called the symbolic link reference is the web server is virtual host file. The host file is this plus specific configuration file so that to tell the web server for example things like where the web files live are or any address rewrite where was that so the stuff for example.
And so we're going to create that first of all and then we're going to paste within all of this low here. Now, we just want to note on there, here what I'm doing is I'm telling it to somebody put file in www. Then it will come out without, all right that’s the rewrite rule. And so if you want that then you want to exactly like this except exchange way why the web for your domain name alternatively if you want it the other way around so that it looks like that but with the HTPP in the front then you need to lose it there, lose that www. There add it there and add it there. Okay now, if you’re now quite sure about that look at my website it explains a bit more thoroughly.
And of course you want to do the same procedure for every site that you act and you want to the same with this the every side of your as well this is the assembling to go along with that V host, that virtual host file that we provided there so that’s the assembling to go along with it. And what it is basically is that telling engine that that is well the way widerweb.com configuration file is the, V host file is and this actually assembling file is going to live there as what you basically think.
So now, we’re going to get on to fast CGI so that engines run with PHP on reboot and say first of all we need to install the Fast CGI Library. And in fact I think I've already got installed but anyway and that’s we have to do for that and then create a file in this low here. And then to make fast CGI that on demand we’re going to create another file and we’re going to big all chunks to pop in here.
Okay and again you don’t have to do anything with it just to save it like that, control XY and enter let me give it permission to start up on a reboot to initiate and creates stuff that hooks. And we’ll start at far CGI, here you go. Okay, just restart engine so starting it and then starting it. If you haven’t followed where the batch RC tutorial for ASS which basically makes life a lot easier you can really simplify your existence so that come online and then you need to type instead that shortcut that one but that is what will work regardless of whether you followed that tutorial. Okay, so we start it.
Good, okay, we can now check the site. So recap—what is it waywiderweb.com and there your go. Okay, brilliant. Yeah, yeah, fantastic, okay, the most simple webpage in the world, right and there's nothing more to say really, I mean you got to add the site using FTP now basically put that in into your public folder there just like I said at the top of the tutorial at the site. If you do one WordPress will be fine tuning our system for that part in part 14 setting up WordPress with pretty you URL and WBC cache all that sort of stuff.
In fact also we’re going to be using subversion and installing that in that tutorial as well for super suit platform and plug in installing really easy upgrade thereafter. And if you're planning on using any well know platform for forums you come as counter management whenever you should check out that particular tutorial because it going to save a bunch of time.
I hope that was handy. If you want to do us favor rate this video, leave a comment, subscribe to the channel all the helps of you are in here in that guvnr.com you can obviously check out and see what's in there. You can run a search for VPS and all of that to find all the various pieces or keep inform to better that web tactic tutorial by subscribing by email or RSS. Okay, thanks a lot. Chow!
Transcription by:
Scribe4you Transcription Services