Mac as Server

From Wikicliki
Revision as of 14:57, 17 July 2016 by WikiSysop (talk | contribs)

Jump to: navigation, search

https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally

Running Commands First, open the Terminal app and switch to the root user so you can run the commands in this post without any permission issues:

sudo su - Enable Apache on Mac OS X apachectl start Verify It works! by accessing http://localhost or http://localhost:8080/

Enable PHP for Apache Make a backup of the default Apache configuration. This is good practice and serves as a comparison against future versions of Mac OS X.

cd /etc/apache2/
cp httpd.conf httpd.conf.bak

Now edit the Apache configuration. Feel free to use TextEdit if you are not familiar with vi.

vi httpd.conf

Uncomment the following line (remove #) - press X over the letter and save with :wq

LoadModule php5_module libexec/apache2/libphp5.so Restart Apache:

apachectl restart

You can verify PHP is enabled by creating a phpinfo() page in your DocumentRoot.

The default DocumentRoot for Mac OS X El Capitan is /Library/WebServer/Documents. You can verify this from your Apache configuration.

grep DocumentRoot httpd.conf Now create the phpinfo() page in your DocumentRoot:

echo '<?php phpinfo();' > /Library/WebServer/Documents/phpinfo.php Verify PHP by accessing http://localhost/phpinfo.php

cd /path/to/project/folder
python -m SimpleHTTPServer 8080

go to:

http://localhost:8080/