You can use it for working with a website right on your iMac, but to use it for a “real” website on the Internet that everyone can see gets a bit complicated and it’s really not worth the trouble, as it’s easier to use a web host for your website.
But first, the best use for OS X’s web server is to learn to work with the code for websites and set up very basic sites. The web server software on your iMac is called Apache, and it’s the same software used by millions of web servers on the Internet. Apache is already installed, and if you turn on Web Sharing in the Sharing Pane of System Preferences, then you will see a link in the pane to the right that will take you to your personal website in your Sites folder in your home directory.
That webpage you see – it will say “Your website” – is the default webpage and is generated by the index.html file in your Sites folder. It’s only on your iMac; it’s not available to the Internet as a whole. That folder is in your hard drive under your User name. Go to your Hard Drive/Users/*yourusername*/Sites and you’ll find it.
You can play around with editing the html of that file. While the “Your website” page is open in Safari, open up Textedit (in your Applications folder) and then use the Open file menu to navigate to the index.html file.
But before you open index.html, tick the box that says “Ignore Rich Text Commands.” That will make TextEdit open the file not as a webpage but as a text document. Inside index.html, you’ll see kind of cryptic code along with the text you see on the webpage. The code is the html markup that styles the text and makes the webpage look like it does.
That may be a bit confusing: what you’re doing is looking at the webpage in Safari but also looking at the source code of if in TextEdit. The source code in the file is what generates the webpage.
You can edit that webpage in TextEdit and then see your changes in Safari. Try changing the title of the page this way: look for the text that says “Your website.” It will be in between two <h3> tags. Change it to “My website.” And then save the TextEdit file, and then go to Safari and reload the page.
There are great tutorials on html at W3C Schools, or just Google for others.
To go beyond simple websites and use something like WordPress or other content management system on your iMac, that’s possible, but you need to install a database server called MySQL. And the easiest way to do that is use what’s called MAMP, which is short for Mac, Apache, MySQL and PHP.
You can “roll your own,” so to speak, not use MAMP. But you will need to install MySQL for a database and what’s called phpmyadmin to help administer the MySQL databases, and it gets a little complicated. But full instructions are here Install Apache/PHP/MySQL on Snow Leopard and also Easiest way to activate PHP and MySQL on Mac OS 10.6 Snow Leopard – Stack Overflow.
If you want to do a real website on the Internet as a whole, it’s easiest to get inexpensive web hosting at a Internet company to hold your website. You can host your own website on your iMac for the world to see, but you will need to have either a static IP address (an address that doesn’t change) or use a dynamic DNS system. And your internet service provider must be willing to let you run a website and not block it.
But as I said, that gets complex and it’s cheaper and easier to get web hosting at a company like Bluehost. You’ll also need a domain name, too, but both companies also are in the business of domain registration.
But then you can upload your own website to a web host and it will be available to everyone on the Internet, or use WordPress or many other systems at them, too, for all to see.