MAC下安装PHP MYSQL NGINX
来源:互联网 发布:中国网络电视直播台 编辑:程序博客网 时间:2024/06/10 04:08
安装Homebrew
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
记得运行brew doctor命令,来确认Homebrew安装正确。如果已经安装过MacPorts或者RVM,会有提示将MacPorts挪走。
sudo mv /opt/local ~/macports
安装和调试Nginx
brew install nginx
安装完成之后,进入/usr/local/etc/nginx目录,这里是相关的配置文件目录。在下面建立一个vhost文件夹,用来放置单独的网站配置。
mkdir vhost
在vhost目录里建立一个default.conf,内容类似如下
server { listen 8080; server_name localhost; #charset koi8-r; #access_log logs/host.access.log main; location / { #这里是网站文件的目录,以下另外一处相同处理 root /Users/feir/sites; index index.html index.htm index.php; } #error_page 404 /404.html; # redirect server error pages to the static page /50x.html # error_page 500 502 503 504 /50x.html; location = /50x.html { root /Users/feir/sites; } # proxy the PHP scripts to Apache listening on 127.0.0.1:80 # #location ~ \.php$ { # proxy_pass http://127.0.0.1; #} # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000 # location ~ \.php$ { root /Users/feir/sites; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /scripts$fastcgi_script_name; include fastcgi_params; } # deny access to .htaccess files, if Apache's document root # concurs with nginx's one # #location ~ /\.ht { # deny all; #} }
将nginx.conf里面的 server { ... }部分全部注销或者删除掉,同时在http {...}模块里增加以下内容
include /usr/local/etc/nginx/vhost/*.conf;
OK,现在已经完成了Nginx的安装,以下为Nginx的管理命令:
sudo nginx // 启动Nginx#重新加载|重启|停止|退出 nginxnginx -s reload|reopen|stop|quit
将Nginx加入开机启动
ln -sfv /usr/local/opt/nginx/*.plist ~/Library/LaunchAgents//启动launchctl load ~/Library/LaunchAgents/homebrew.mxcl.nginx.plist
安装MySQL
brew install mysql
初始化Mysql数据库
#修改 feir 为自己的用户名mysql_install_db --verbose --user='feir' --basedir="$(brew --prefix mysql)" --datadir=/usr/local/var/mysql --tmpdir=/tmp
启动Mysql
mysql.server start
目前访问mysql是不需要密码的,如果需要的话,得运行配置下
mysql_secure_installation
按照提示进行操作就可以。
将mysql加入开机启动
ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents//启动launchctl load ~/Library/LaunchAgents/homebrew.mxcl.mysql.plist
管理数据库 如果喜欢界面化管理mysql,在Mac上可以用Sequel Pro,比PHPmyadmin好用。
安装PHP
brew tap homebrew/dupesbrew tap josegonzalez/homebrew-phpbrew install php55 --with-fpm --with-mysql
将PHP加入开机启动
mkdir -p ~/Library/LaunchAgentscp /usr/local/Cellar/php54/5.4.19/homebrew-php.josegonzalez.php54.plist ~/Library/LaunchAgents/launchctl load -w ~/Library/LaunchAgents/homebrew-php.josegonzalez.php54.plist
各类配置文件
nginx /usr/local/etc/nginx/nginx.conf
PHP (FPM) /usr/local/etc/php/5.4/php-fpm.conf
PHP (CLI) /usr/local/etc/php/5.4/php.ini
Mysql /usr/local/opt/mysql/my-new.cnf
0 0
- MAC下安装PHP MYSQL NGINX
- mac安装nginx mysql php
- Mac 下 Nginx、MySQL、PHP-FPM 的安装配置
- Mac环境下Nginx+PHP+MySQL的安装与配置
- Mac 下 Nginx、MySQL、PHP-FPM 的安装配置
- Mac OSX 下安装nginx mysql php 本地开发环境
- mac下安装 apache/nginx/MySQL/PHP 多版本
- [PHP] Mac下homebrew安装及php.mysql.nginx环境安装及配置
- MAC安装nginx+php-fpm+mysql
- mac下安装nginx和php
- mac下安装nginx和php
- mac-php-nginx安装
- Linux下Nginx+PHP+Mysql安装,Nginx配置文件支持PHP
- Nginx WIN7下安装PHP的MySQL
- ubuntu11.10下安装nginx+php+mysql
- Ubuntu下安装Nginx+PHP+MySQL+FastCGI
- centos下 nginx+mysql+bugfree+php安装
- centos下安装 nginx php mysql
- 初学JAVA,一段网络通信小代码的问题解决
- 文本挖掘技术笔记
- 前端代码规范 及 最佳实践
- error LNK2001: 无法解析的外部符号 "class boost::system::error_category const & __cdecl boost::system::system_
- os.mkdir()和os.path.join()的区别
- MAC下安装PHP MYSQL NGINX
- Stm32RS232串口通信——中断接收发送数据
- Android 安全攻防
- Eclipse导入android项目时版本冲突问题
- 集合类SetListMap
- 第十一周项目二求最大公约数(1)(2)
- actioncontext.getcontext()详解
- 需要uac交互的程序如何自启动
- VS调式技巧