Difference between revisions of "Mac as Server"

From Wikicliki
Jump to: navigation, search
(use nano)
(this is what i did to run things locally in jan 2018)
 
Line 62: Line 62:
  
 
sudo apachectl restart
 
sudo apachectl restart
 +
 +
cd /Library/WebServer/Documents/
 +
 +
python -m SimpleHTTPServer 8080
  
 
== problem after el capitan ==
 
== problem after el capitan ==

Latest revision as of 03:46, 7 January 2018

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/

this is what i did to run things locally in jan 2018

http://osxdaily.com/2012/09/10/enable-php-apache-mac-os-x/

sudo nano /etc/apache2/httpd.conf

Now hit Control+W to use the search feature of nano, and type in “php”

Locate the following line and remove the comment (#) from the beginning:

LoadModule php5_module libexec/apache2/libphp5.so

Now hit Control+O to save the changes, followed by Control+X to quit out of nano.

Back at the command prompt, you’ll want to restart the Apache server

sudo apachectl restart

cd /Library/WebServer/Documents/

python -m SimpleHTTPServer 8080

problem after el capitan

http://apple.stackexchange.com/questions/211015/el-capitan-apache-error-message-ah00526

what this guy said:

Trying to get apache2 working I get the following error message:

AH00526: Syntax error on line 20 of /private/etc/apache2/extra/httpd-mpm.conf: Invalid command 'LockFile', perhaps misspelled or defined by a module not included in the server configuration.

It says LockFile is a correct directive. I don't know why I'm getting the same error you are. So in terminal, I went to:

/etc/apache2/extra and restored the httpd-mpm.conf file from before I loaded El Capitan. I used these commands:

sudo mv httpd-mpm.conf httpd-mpm.conf.elcapitan sudo mv httpd-mpm.conf~orig httpd-mpm.conf and entered the commands:

sudo apachectl restart apachectl configtest and got "Syntax OK"

If I enter http://localhost in my browser, I get the page "it works".