Sunday, June 12, 2011

Servers on Mac

Personal tips for setting up MAMP (Mac, Apache, MySQL, PHP):

The main reason why you have apache on mac is because of sharing (system preferences -> sharing -> web sharing). And by default, apache is configured to listen on port 80 and include a bunch of config files in /private/etc/apache2/[users,other]
Virtual hosts are not setup by default.

Things I do for running a development server:
- changed port to listen on another port (say 8000, 8080)
- set up http auth for security reasons

Stuff I put in my .zshrc:

alias couch_start="sudoge launchctl load -w /Library/LaunchDaemons/org.apache.couchdb.plist"
alias couch_stop="sudo launcctl unload /Library/LaunchDaeons/org.apache.couchdb.plist"
alias couch_restart="sudo launchctl stop org.apache.couchdb"

alias apache_start="sudo apachectl start"
alias apache_stop="sudo apachectl stop"
alias apache_restart="sudo apachectl restart"

alias mysql_start="sudo /usr/local/mysql/support-files/mysql.server start"
alias mysql_stop="sudo /usr/local/mysql/support-files/mysql.server stop"
alias mysql_restart="sudo /usr/local/mysql/support-files/mysql.server restart"

alias mysql="/usr/local/mysql/bin/mysql"

No comments: