Forum Moderators: phranque
I am looking to turn my machine into a Web Server as I own a domain name and would like to point it to my local home machine so I dont have to buy web space to host the site on.
I would say I am kind of familiar with Web Servers and apache configuration files but have not got a '/etc/httpd' directory (on my home machine) and was interested to know if its as simple as downloading Fedora or Red Hat on my machine then setting them up?
I am very interested in setting this up as I know there are many challenges such as giving my machine (which internet connection runs on a B.T homeHub router) a static IP.
Would LOVE any help here.
Thanks all
1) Security. Do not use this same machine for anything else. Do not allow it to communicate on the same subnet as you other networked home computers. Until you know enough about locking down an Apache server on Windows (not an easy thing to do), you should treat this machine as 'always suspect' and assume that it *has* been hacked.
2) Your ISP's policies. Be sure that they allow their customers to run servers, as the upload/download traffic profile of a server is opposite from that of a client, and can disrupt their carefully-engineered network upload/download traffic balancing. For this reason, home servers are easy for them to detect. Most ISPs do not allow customers to run servers on 'home' ISP services, and some of them will ban you for life for doing it -- Not good if that company is your only local ISP option.
3) A third challenge is staying up all night watching your server, and providing fail-safe power and environmental control. It may also be difficult to get a second internet connection from a truly-separate-network provider to back up your current one in case of problems. Then there's the "no holidays" and "don't ever leave the house" policies you'll need to enforce on yourself to be sure that there is always a server admin present to handle problems... This is all a bit toungue-in-cheek, but paying for a good-quality host is one of the best deals you can get; And be warned that the cheapest hosting is the most expensive in the long term; You'll have more trouble, less support, and less-competent support if you can get any support from a 'cheap' host.
Those caveats out of the way, look around at the various WAMP, XAMPP, Living-Room-Lamp 'bundles' that you can download; These contain mixtures of Apache, MySQL, PHP, PERL, and other useful stuff. Pick the one that suits your needs and install it.
If you've got Windows' IIS server enabled on your machine -and it has often been enabled by default in the past- then disable it using the Add/Remove Programs -> Windows Components dialogs. If you don't, then IIS will grab port 80 on start-up, and Apache won't be able to connect to it to get access to the internet. The default port setting of Skype can also cause the same problem, so if you're using Skype, change its port number.
Jim
I have installed XAMPP and am going to look into the first 2 issues mentioned.
I was wondering if I was to point a web domain name at my servers static IP (when I have looked more into first two issues) and create an Apache Config pointing to a directory on my server, would the HTTP Host header sent to my Home Webserver find the apache config which is now inside /opt/lampp/htdocs/ and not the usual /etc/httpd/vhosts.d/ or will it only run locally?
[edited by: jdMorgan at 10:10 pm (utc) on Dec. 20, 2009]
[edit reason] No URLs, please. See TOS. [/edit]
If you don't have a static IP, all is not lost - look for some of the dynamic DNS providers out there - however, if your ISP won't offer a static IP, it's a pretty good sign that running a server is frowned upon in any case ;)
A lot of webmasters would love to run their own servers locally, but it's harder than it would at first seem. Usually it is a better bet to host in a real datacenter, which has much faster network connections and offers better uptime due to multiple redundant connections and generators for when there's a power cut.
If you do decide to try out home hosting, then you should use a dedicated machine for the task.
URLs are not the same things as filepaths, and there's no reason for the server to 'expose' any filepath 'above' your home directory (defined as "DocumentRoot" in the server config) on the Web. In fact, one could argue that the primary purpose of a server is to translate URLs to filepaths, so that filepaths need not be exposed on the Web as URLs -- and subject to change if you (or your host) re-arranged your filesystem.
Free hosting ... meh. If this project isn't worth proper hosting, then I'd ask if it was worth doing at all. Again, cheap (or free) hosting is going to cost you more in time and headaches than it's worth. Really. I've seen it happen for over 15 years now. If you count your time worth anything, then both free and cheap hosting on the one end, and very-expensive hosting on the other 'cost' the most. Decent-grade hosting ($10-$15/month) is the truly-least-expensive.
The difference between free hosting and decent hosting is this: If you run free, you'll get basically no support or incompetent support, the capabilities of your server will be limited (e.g maybe you won't be able to use mod_alias and mod_rewrite to do redirects or rewrites), and the host may plaster their ads (of questionable relevance, quality, and 'good taste') all over your site.
If on the other hand you go with decent hosting, then you can sign up for AdSense (or similar), and then you will have some control of (and reap the profits from) placing ads on your site. Then take that money and pay your hosting bill.
And BTW, I have absolutely no business interests in any hosting companies, so this is objective 'friendly' advice, not a sales pitch of any kind. I've just been watching people beat their heads against the wall on poor hosting or home hosting, and I hate to see another Webmaster heading down that path.
Check out GeoCities, one of the first free hosting services. They just shuttered their doors recently, and many thousands of old-but-good-quality sites have now utterly disappeared. All that work done by the Webmasters who built those sites and all the 'knowledge' they published on those sites is lost. :(
Jim
Think I am having trouble phrasing my previous question tho.
I thought that once I had installed XAMPP it would create a "/etc/httpd/v.hosts/" directory, instead it created its own "/opt/lampp/etc/" directory for Apache Configuration files.
Would I be wrong to point a Domain at my Server (once its up and running) and expect it to find an Apache Config located inside "/opt/lampp/etc/" .If it is incorrect to do so, could I set up a "/etc/httpd/v.hosts/" directory manually (i.e. mkdir) myself?
Thanks for you help so far, filling in alot of gaps, sorry to keep it going but am learning too much. lol.
> Would it help to download Apache2 for my version of Linux (Debian) too?
As opposed to what?
I'd suggest you get whatever 'package' you downloaded working first --in the most basic configuration-- before starting to customize it. And then make only small changes one-at-a-time. Otherwise, you're going to spend an awful lot of time getting this working. The initial learning curve is rather steep, so proceed with caution -- and always keep backups of *everything* from your last-working version!
Jim
sudo apt-get install apache2 mysql php5 (Note the exact names are from memory, you should check on the Debian website).
Debian's setup is a little unusual in terms of setting up virtual hosts, but there are a series of command-line tools for setting them up, and Debian's documentation is usually excellent. Debian works best when you use their repositories and standard system, not only due to the ease of configuration, but also because you will get automatic security updates for the packages from their security team. This is vital if you are running a live server.
For more specific advice about how to install a Debian-based LAMP server, and about Debian in general, try the WebmasterWorld Linux forum:
[webmasterworld.com...]