jetshack
Posts: 9
Joined: Thu May 21, 2015 6:12 pm

Creating a server host file after the fact.

Mon Mar 28, 2016 5:48 pm

I can't find anything on how to go about this:

I set up a webserver (nginx), and also installed PHP and MySQL. After that I installed WordPress and started populating a website with content. I was very pleased with myself...

And then I realized that I'd like to put another website on this server. So I looked at how to do it and found out about the server host file...

I found lots of information on how to make the file. However, I found nothing on how to go about it if there was already a site being hosted on the server.

So my question is, how do I go about it at this point?

Is the easiest solution to backup the current site that is there, then delete the WordPress site off of the server, create the server host file, then reinstall WordPresss into the appropriate new file structure, and then import the site? Or is there a simpler way?

asandford
Posts: 1997
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Creating a server host file after the fact.

Mon Mar 28, 2016 7:11 pm

You can add virtual servers to the webserver (multiple websites served from one webserver), the documentation is here.

jetshack
Posts: 9
Joined: Thu May 21, 2015 6:12 pm

Re: Creating a server block file after the fact.

Mon Mar 28, 2016 8:48 pm

That's one of the things I looked at prior to making this post. It does a great job of detailing how to set up a virtual host PRIOR to a site being placed on the server, but I couldn't see where it spelled out what to do if a site was already on the server prior to a site being hosted.

I think it will be a directory question. for example my index.php file is currently located at something like /var/www/html but when creating the server block (just realized i used the wrong word in the title and fixed that) it would be at something like /var/www/example.com/html. Then any additional sites could be inserted with additional call-outs like /var/www/another_example.com/html.

I'm willing to bet at this point I can't just expect to create the server block and expect it to work.

asandford
Posts: 1997
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Creating a server host file after the fact.

Mon Mar 28, 2016 9:17 pm

Retro-fitting is possible, and as you said, it's just the directory structure.

So, move everything from /var/www to /var/www/site1/, then fix the references in the config files such that they point to the new location.

Sam Hobbs did a good tutorial (he uses Apache, but the concepts are the same).

frafrichile
Posts: 42
Joined: Wed Mar 05, 2014 3:11 pm

Re: Creating a server host file after the fact.

Mon Mar 28, 2016 9:21 pm

I actually need help with the same except I am using Apache. :|

asandford
Posts: 1997
Joined: Mon Dec 31, 2012 12:54 pm
Location: Waterlooville

Re: Creating a server host file after the fact.

Mon Mar 28, 2016 9:25 pm

frafrichile wrote:I actually need help with the same except I am using Apache. :|
Sam Hobb's Tutorial linked in my answer above.

jetshack
Posts: 9
Joined: Thu May 21, 2015 6:12 pm

Re: Creating a server host file after the fact.

Mon Mar 28, 2016 9:35 pm

Awesome.

I think I can figure that one out.

Return to “Networking and servers”