<commit_before><commit_msg>add aticle apache mysql nginx set up in OS X 10.10<commit_after>---
layout: post
title: apache config in osx
date: 2015-04-03 16:41:42 +0800
---

# install apache

`brew install apache`, 

### set up mysql in osx

``` sh
To connect:
    mysql -uroot

To have launchd start mysql at login:
    ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents
Then to load mysql now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
Or, if you don't want/need launchctl, you can just run:
    mysql.server start
```

### creae user in mysql

```
CREATE USER 'newuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON * . * TO 'newuser'@'localhost';
FLUSH PRIVILEGES;
```

### install ngnix

`brew install nginx`, 

```
Docroot is: /usr/local/var/www

The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.

To have launchd start nginx at login:
    ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
Then to load nginx now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
Or, if you don't want/need launchctl, you can just run:
    nginx
```



```
 $ brew install nginx --with-passenger

To activate Phusion Passenger for Apache, create /etc/apache2/other/passenger.conf:
  LoadModule passenger_module /usr/local/opt/passenger/libexec/buildout/apache2/mod_passenger.so
  PassengerRoot /usr/local/opt/passenger/libexec/lib/phusion_passenger/locations.ini
  PassengerDefaultRuby /usr/bin/ruby

Docroot is: /usr/local/var/www

The default port has been set in /usr/local/etc/nginx/nginx.conf to 8080 so that
nginx can run without sudo.

To activate Phusion Passenger, add this to /usr/local/etc/nginx/nginx.conf, inside the 'http' context:
  passenger_root /usr/local/opt/passenger/libexec/lib/phusion_passenger/locations.ini;
  passenger_ruby /usr/bin/ruby;

To have launchd start nginx at login:
    ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents
Then to load nginx now:
    launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
Or, if you don't want/need launchctl, you can just run:
    nginx
```


install passenger with nginx

`sudo passenger-install-nginx-module`


Now for your new entry to take effect, the DNS cache needs to be flushed.

```
dscacheutil -flushcache
```


###

```
root:david
developer:passwd
```
{'fraction_non_alphanumeric': 0.11059714045416316, 'fraction_numerical': 0.01345668629100084, 'mean_word_length': 3.8650306748466257, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4145059', 'n_tokens_mistral': 889, 'n_tokens_neox': 810, 'n_words': 251}