Mac OSX as web server?

Posted:
in macOS edited January 2014
Hi, everyone. I was hanging out at my favorite photo forum PhotoCamel and ran across this thread that states you can use the Mac OSX OS to run a web server from:



Got Mac OSX?



How many of you are actually using this feature? It sounds wonderful to me. What do I need to do to get it running?



Will an ISP get PO'd if I use it because I'm "uploading" lots of data?

Comments

  • Reply 1 of 18
    placeboplacebo Posts: 5,767member
    I use it on occasion. It's best used in conjunction with a dynamic DNS service such as dyndns.org, so that you can use one easy-to-remember address that stays the same (unless you have an expensive connection, your IP address typically changes every few days)
  • Reply 2 of 18
    Quote:

    Originally posted by Placebo

    I use it on occasion. It's best used in conjunction with a dynamic DNS service such as dyndns.org, so that you can use one easy-to-remember address that stays the same (unless you have an expensive connection, your IP address typically changes every few days)



    How much is dyndns?
  • Reply 3 of 18
    I use the feature with PHP turned on to work on websites. I know very little PHP and i don;t use databases. I just use PHP for some includes and allowing one edit to be universal (along with CSS). To turn PHP on, you need to google for a tutorial



    Otherwise, i do find it easier to use a web-host. There are many great ones out there. I personally use Lunarpages (who just did a major upgrade across the board to the service).



    Please note: i am not affiliated with Lunarpages, i just like them. They are cheap enough and offer enough to make it work the money. PM me if you would like to learn more.



    Anyway, the built in one does run Apache which is very stable so i guess its possible



    Addendum: i think dyndns is free but there are also other free dynamic DNS services. I, at one point use no-ip.com but it has been a long time
  • Reply 4 of 18
    I'd never use it for full time stuff just to host files that aren't getting used 24/7.
  • Reply 5 of 18
    ast3r3xast3r3x Posts: 5,012member
    Most ISP's say you can or can't host servers of any kind.
  • Reply 6 of 18
    gongon Posts: 2,437member
    Easy. To get it running, go to System Preferences -> Sharing. Check the "Web serving" box. The Apache webserver is up and running in a second or two. You are web serving! If you go to "http://yourcomputerIPaddress"; on a web browser, you see the Apache default index page.



    Then to get stuff shared, you put it on one of two places.

    If you put it in the Sites folder under your home folder, it's reachable at "http://yourcomputerIPaddress/~yourusername/filename".

    If you put it under Library/WebServer/Documents (the main Library, not the one under your home folder) it's reachable at "http://yourcomputerIPaddress/filename". You can replace the standard index.html page from that directory so a plain "http://yourcomputerIPaddress"; gets you to your own page instead of showing the Apache default.
  • Reply 7 of 18
    relicrelic Posts: 4,735member
    Quote:

    Originally posted by Gon

    Easy. To get it running, go to System Preferences -> Sharing. Check the "Web serving" box. The Apache webserver is up and running in a second or two. You are web serving! If you go to "http://yourcomputerIPaddress"; on a web browser, you see the Apache default index page.



    Then to get stuff shared, you put it on one of two places.

    If you put it in the Sites folder under your home folder, it's reachable at "http://yourcomputerIPaddress/~yourusername/filename".

    If you put it under Library/WebServer/Documents (the main Library, not the one under your home folder) it's reachable at "http://yourcomputerIPaddress/filename". You can replace the standard index.html page from that directory so a plain "http://yourcomputerIPaddress"; gets you to your own page instead of showing the Apache default.




    But...make sure you go into the terminal first and type "sudo chmod 777 /Library/WebServer/Documents" first or you wont be able to jack. Then after everything is setup you can chmod 444 it to protect your data. OSX is like any other Unix perfect for a webserver. May I suggest Apache 2.0 and PHP 5.0 as well. Go to www.entropy.ch for those needs, hmmm and guess who creates some of those binaries.
  • Reply 8 of 18
    placeboplacebo Posts: 5,767member
    DYNDNS.org is free for the basic services that you'll want.



    The entropy.ch PHP package is awesome.
  • Reply 9 of 18
    mdriftmeyermdriftmeyer Posts: 7,503member
    For f'n cryin' out loud its Apache.



    Download Apache2 and compile it for OS X or use Fink and let it install it for OS X. Then follow various instructions to register it as a service and make it available on your host.



    Get a static ip address and then you don't have to muck with dyndns.org.



    Or just pay to colocate your box in a center and ssh to the damn thing with SVN set up or CVS so that you can update your entire site, when you feel like it.
  • Reply 10 of 18
    gongon Posts: 2,437member
    Quote:

    Originally posted by mdriftmeyer

    For f'n cryin' out loud its Apache.



    Download Apache2 and compile it for OS X or use Fink and let it install it for OS X. Then follow various instructions to register it as a service and make it available on your host.



    Get a static ip address and then you don't have to muck with dyndns.org.



    Or just pay to colocate your box in a center and ssh to the damn thing with SVN set up or CVS so that you can update your entire site, when you feel like it.




    OP seems to want simple web serving, not excessive configuring or investment.



    I have never thought using CVS or SVN to update website, but I guess it makes sense. When you say "so you can update your entire site" do you mean things like making a new branch for major site recode while the "current" site still gets minor updates?
  • Reply 11 of 18
    mdriftmeyermdriftmeyer Posts: 7,503member
    Quote:

    Originally posted by Gon

    OP seems to want simple web serving, not excessive configuring or investment.



    I have never thought using CVS or SVN to update website, but I guess it makes sense. When you say "so you can update your entire site" do you mean things like making a new branch for major site recode while the "current" site still gets minor updates?




    Either branch new code, test in a staging server, then push to a deployment server, or using revision control on your source that then gets push an hour or so later to the active site.



    You can use virtual hosting locally to test on an apache2 server instance, and then push it to the proper host name that you resolve via dns, which is another virtual host reference.



    There are quite a variety of options, even on the low end.



    I use Subversion to have version history. It's also on a staging system [raid mirrored] which via a cron job gets pushed to the deployment server at a specified time. Any changes get pushed to the deployment server.



    We're not talking about loadbalancing schemes, just a simple way to keep your site archived and easily fixed if a drive fails along the way.



    Btw: I develop on Linux and OS X. The linux system is very inexpensive and both have Apache2 running. Costs are minimal. Other than time, its all open source. What veries is one's skills, but then again your skills expand proportionally to your investment of time into learning what you can do with web development/deployment and/or site design.



    Now the guy discusses his upload issues. That is transfer traffic as we all know through his ISP managing his DNS services. If he wants to do it right he should purchase a domain and purchase a static ip address with DSL or even Cable, or whatever his backbone provider allows via either through the ISP or is the actual ISP.



    He should also know the more traffic his site accumulates the more likely he'll surpass a monthly upload limit before he gets surcharged.



    Regardless, OS X having this capabilities as being a surprise to him is what surprised me. It's UNIX.
  • Reply 12 of 18
    placeboplacebo Posts: 5,767member
    Quote:

    Originally posted by mdriftmeyer

    For f'n cryin' out loud its Apache.



    Download Apache2 and compile it for OS X or use Fink and let it install it for OS X. Then follow various instructions to register it as a service and make it available on your host.



    Get a static ip address and then you don't have to muck with dyndns.org.



    Or just pay to colocate your box in a center and ssh to the damn thing with SVN set up or CVS so that you can update your entire site, when you feel like it.




    Apache 2.0 is widely regarded to be unstable and incompatible with PHP/MySQL.



    And Dynamic DNS is insanely easy and free. This guy isnn't looking for a 24/7 high-load server solution.
  • Reply 13 of 18
    Quote:

    Originally posted by Placebo

    Apache 2.0 is widely regarded to be unstable and incompatible with PHP/MySQL.



    And Dynamic DNS is insanely easy and free. This guy isnn't looking for a 24/7 high-load server solution.




    I use both with no problems...and that's on a windows computer (yes, I know, shut up) where you'd really expect it to be unstable...is it any different for OSX/UNIX?
  • Reply 14 of 18
    relicrelic Posts: 4,735member
    Quote:

    Originally posted by mynamehere

    I use both with no problems...and that's on a windows computer (yes, I know, shut up) where you'd really expect it to be unstable...is it any different for OSX/UNIX?



    No... I use them both in a production environment with NULL problems. Add MySQL 4.1 to that roundup and you got the powerful golden trio of web programming.
  • Reply 15 of 18
    placeboplacebo Posts: 5,767member
    I just read it in a PHP book that was probably from 2003 or so.



    And from Apple's decision to keep Apache 1.3 in OS X 10.4 Server instead of having 2.0 the default. (2.0 is preinstalled, but isn't the default)
  • Reply 16 of 18
    Apache 2.1 is nearing completion and will be without a doubt the default web server in OS X 10.5 and conceivably 10.4.x whenever it is released.



    PHP issues with Apache 2 are resolved.
  • Reply 17 of 18
    xoolxool Posts: 2,460member
    Quote:

    Originally posted by Placebo

    The entropy.ch PHP package is awesome.



    Here here!



    While it is not necessary for beginners, it is a huge asset for Pros. Marc Liyanage's package saves me time and what more could one ask for?! I use Marc's PHP 5 package to develop my BART Widget for Mac OS X, as well as my WoodWare website in general. I highly recommend it!



    With it and a point-and-click MySQL installation, what more could one want?
  • Reply 18 of 18
    placeboplacebo Posts: 5,767member
    Not even just professional users; having the option of include() instead of having to find-and-replace across all of your site's documents is great.



    PHP is erally addicting once you see all that you can do with it plus MySQL. It made my last website a breeze to code and design, and I could preview it all on my Mac with PHP installed.



    Oops, looks like I broke W3 compliance somehow, better fix that today.
Sign In or Register to comment.