Jump to content

Hosting your own domains, subdomains and subdirectories in wordpress and apache?

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
6 replies to this topic

#1
onething

onething

    Programmer

  • Members
  • PipPipPipPip
  • 118 posts
Hi, I'm pretty desperate and lost at how I would go about doing that which the title says. I have WAMP, but how would I go about editing my website from my own localhost? I have a very ****ty reseller with Hostnine and it doesn't allow most of my plugins to work, so I'd like to have somewhere I could pull this data from. With some plugins I might need the domain to be where I'm pulling the data from, but for others I'd be satisfied if I could just drag my multisite (subdomainish or subdirectoryish) into my localhost, edit it there and play around with it and then be able to put it back up again)

Ok, so I have WAMP, what would I now have to do to Apache server to get it to allow multisite?

#2
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
Hi, if you are wanting subdomains find your Apache's httpd.conf configuration file which should be located somewhere in the WAMP folder, you may set it up like this:
<VirtualHost *:80>
   ServerName subdomain1.domain.local
   DocumentRoot /wamp/www/subdomain1
 </VirtualHost>
 
 <VirtualHost *:80>
   ServerName subdomain2.domain.local
   DocumentRoot /wamp/www/subdomain2
 </VirtualHost> 
You will need to then modify the file "C:\WINDOWS\system32\drivers\etc\hosts" and add the following entry:
127.0.0.1 domain.local
You can change domain.local to what you wish, they need to point to the same thing.

Once you call http://subdomain1.domain.local/ or http://subdomain2.domain.local/ they should automatically point to the appropriate folder within www/, or wherever you may wish to set them up. You can change the subdomains to what you wish. Remember to restart Apache/WAMP.

Is this what you were looking for?
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#3
LuthfiHakim

LuthfiHakim

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 765 posts
Do you want your sites to be available publicly or not? If you want they're only available to you then Alexander's post already covers the basic things. If you want them to be available to public, then you gotta have a public IP address and you must update/add some entries to the dns server of your domain instead of using your local hosts file. For dns server you can contact with ISP with whom you registered your domain.

On apache's configuration, I believe it's better to put the VirtualHost entries in httpd-vhost.conf instead of in httpd.conf. They still work in httpd, just for better organization.

#4
onething

onething

    Programmer

  • Members
  • PipPipPipPip
  • 118 posts
Yo, thanks for the response

I'll get on that immediately, once i do some link building i gotta set up this afternoon.

HOWever, indeed, I'd like to know three things. I'm also assuming the private domain and subdomain solution you're giving me will mean I can filezilla it to the cpanel where my domain is and that it will fit in perfectly.

One, is how to setup the real domain on my local ip, if my ip is pretty much dynamic.

And the second, is going public a danger for my pc. Should I set it up in a VM for this reason, but **** that would occupy resources! (one plugin I wanna use requires a real domain, the other perhaps may not so I'm on the fence)

The third is assuming I get the private option. When I want to download my website to edit it, will it save the real domain, subdomain and subdirectory names or will something go corrupt?

#5
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts
Your first question: If your site is dependent on many third party scripts (cpanel, etc) then porting your website to your private server will be difficult, although all you will need to do is match both your Apache's virtualhosts files together, so subdomains can work. Remember it will be on a different domain (your private one), so you will need to mind where the links point to.

2: You can use a free or paid service such as no-ip.org (I believe that is the site) which will handle your dynamic IP and give it to the site each time it updates, giving you a semipermanent host (such as yourname.no-ip.org) to point your domain to. This is if you want to host your site (with your real domain name and subdomain) on your computer

Your second question: I assume you are going to be using a Windows computer to host your site, the scripts may not work or rely on permissions to be set, Windows does not have permissions so security holes in your application may be many times more dangerous than on your web server, you will need to run WAMP under a limited user (not admin) and make sure it has no accesses to private files. I am unsure of how to limit its access on Windows, I am sure there are resources out there.

Your third question: Yes, as long as you update your Apache's virtual hosts to match your servers, you can keep your real domain and subdomain, remember subdomains only point to a specific folder containing the documents (like my first virtualhosts example up above), so you can create folders for each of your subdomains and create new virtual hosts directives for each subdomain. There are many tutorials online, reading more than one may help out a lot.

Also: As there is only mappings of servers (subdomain.domain.com -> /www/subdomain/) there is nothing to corrupt, unless your website explicitly relies on cPanel, but remember cPanel is just a PHP script that edits .htaccess files and aids you in server administration, and it also costs a lot to install on your local computer, so that may not be the best option to keep it. although you can. It is completely unknown if your site will completely work out of the bat on your home computer, you may need to spend a lot of time fixing your site up.

It is late, so feel free to ask any questions if I made a bit less sense, or where to get started on your choice. :)
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.

#6
onething

onething

    Programmer

  • Members
  • PipPipPipPip
  • 118 posts
Hey thanks a ton for the feedback.

Let's divide it in two pieces. Right now I'm not planning, for simplicity's sake, to go for the real domain directed to my dynamic IP. But if I would, what would be a free solution?

And now for what I plan on doing these next few days, as it seems less complicated. Set up fake domains and/or allow my local IP to calmly edit away and upload and download from my server whenever I want it to.

For this i ask:

In what way is my wordpress site dependant on CPanel. Admittedly I haven't played around with something I'v read great things about and its cracked too, something called BackUpBuddy, where apparently you can back the sites up, though I'm not sure you can edit them or if they depend on cpanel. Be that as it may, my question is in what way is my innocent looking wordpress folder, called public-html dependant on the cpanel or anything else. Other than the fact that cpanel has allowed it wildcard subdomains? Now, there are manuals that address how to setup wildcard subs on first page of google, and I think Alexander's soltution solves that too, so I think I'll have that covered. And others that address path problems, which off the top of the bat I guess I'd solve by naming the fake domain the same as the real domain. But right now, I wanna ask you if all I'm seeing on filezilla that relates to the Apache of the Cpanel is the httpd.conf file which I should be replicating at home and should be the same as the crappy reseller I'm at and looking at in my filezilla. So my question is, where in the filezilla is this httpd.conf file or should I be asking technical support for info about their cpanels?

#7
Alexander

Alexander

    It's Science!

  • Moderators
  • 4,124 posts

Quote

Right now I'm not planning, for simplicity's sake, to go for the real domain directed to my dynamic IP. But if I would, what would be a free solution?
Yes, essentially (I think, my knowledge is old) that no-ip will run a client on your computer which will upload your new dynamic IP each time it changes, no-ip.org will then update your subdomain (yoursite.no-ip.org) to point to that new dynamic IP, it is not a complicated process so it can easily be free, there are possibly other services on the web of which do this.

Quote

So my question is, where in the filezilla is this httpd.conf file or should I be asking technical support for info about their cpanels?
This file will be out of your public HTML folder, it would be in Linux's directory of something like /etc/apache2/httpd.conf,

cPanel will most likely use virtual directories, which _may_ be located in /etc/apache2/sites-available/ folder, the files within that folder will store all of the needed subdomain information that you can copy and modify to your own server. You do not need to copy them, you can build the sites-available folder yourself with each subdomain of which you use, that way it will not require you to contact your host although you just need a little knowledge of how virtual hosts work.

If you are just using wordpress, then yes cPanel will have little to no effect on the integrity of your website, you just need to get each subdomain's contents, place them in separate folders, and use virtual hosts to point each subdomain to the specific folders of where your subdomains contents are located, so Apache can point them to the correct folders.
Be sure to read the updated FAQ! || Health is achieved through the same 10,000 steps.
If a suggested code/method fails, informing us is less important than telling us why or what errors occurred.