系统: OS X Yosemite 10.10.1 系统自带php和php-fpm 路径备注:
|
1 2 3 4 |
php.ini: /etc/ php-fpm.conf:/etc/ nginx.conf:/usr/local/etc/nginx/nginx.conf nginx 默认root:/usr/local/opt/nginx/html |
1.安装nginx,我使用了brew
|
1 |
brew install nginx |
2.启动php-fpm
|
1 |
sudo php-fpm |
如果报错的话,复制php-fpm.conf.default一份,修改php-fpm.conf的error_log 存放的路径或启动的端口 3.打开nginx.conf 开启php的注释,配置好自己的root
|
1 2 3 4 5 6 7 |
location ~ \.php$ { root /Users/maming/php; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } |
注意
|
1 2 3 4 5 |
SCRIPT_FILENAME /script$fastcgi_script_name; 要改成 SCRIPT_FILENAME $document_root$fastcgi_script_name; |
否则回报文件不存在的。 4.开启nginx
|
1 2 3 4 |
sudo nginx 或重启 sudo nginx -s reload |
from:http://www.2cto.com/os/201504/390021.html
View Details#定义Nginx运行的用户和用户组 user www www; #nginx进程数,建议设置为等于CPU总核心数。 worker_processes 8; #全局错误日志定义类型,[ debug | info | notice | warn | error | crit ] error_log /var/log/nginx/error.log info; #进程文件 pid /var/run/nginx.pid; #一个nginx进程打开的最多文件描述符数目,理论值应该是最多打开文件数(系统的值ulimit -n)与nginx进程数相除,但是nginx分配请求并不均匀,所以建议与ulimit -n的值保持一致。 worker_rlimit_nofile 65535; #工作模式与连接数上限 events { #参考事件模型,use [ kqueue | rtsig | epoll | /dev/poll | select | poll ]; epoll模型是Linux 2.6以上版本内核中的高性能网络I/O模型,如果跑在FreeBSD上面,就用kqueue模型。 use epoll; #单个进程最大连接数(最大连接数=连接数*进程数) worker_connections 65535; } #设定http服务器 http { include mime.types; #文件扩展名与文件类型映射表 default_type application/octet-stream; #默认文件类型 #charset utf-8; #默认编码 server_names_hash_bucket_size 128; #服务器名字的hash表大小 client_header_buffer_size 32k; #上传文件大小限制 large_client_header_buffers 4 64k; #设定请求缓 client_max_body_size 8m; #设定请求缓 sendfile on; #开启高效文件传输模式,sendfile指令指定nginx是否调用sendfile函数来输出文件,对于普通应用设为 on,如果用来进行下载等应用磁盘IO重负载应用,可设置为off,以平衡磁盘与网络I/O处理速度,降低系统的负载。注意:如果图片显示不正常把这个改成off。 autoindex on; #开启目录列表访问,合适下载服务器,默认关闭。 […]
View DetailsConfigure Error: Please specify the install prefix of iconv with --with-iconv=<DIR> 解决: ./configure --without-iconv
View Details打开终端 重启apache:sudo /usr/sbin/apachectl restart 关闭apache:sudo /usr/sbin/apachectl stop 开启apache:sudo /usr/sbin/apachectl start from:http://blog.csdn.net/nightelve/article/details/7935795
View DetailsApache和PHP已经在系统里面预装好了,只要你开启即可使用。这篇文章给大家介绍如何开启并设置好PHP开发环境。 1.开启默认Apache服务 打开终端命令行,输入如下命令就会开启Apache了.然后输入top命令查看进程是否含有http。
|
1 |
sudo apachectl start |
2.修改Apache配置文件 在Finder右键点击“前往文件夹”后输入“/etc/apache2/ ”然后打开httpd.conf。我们要修改开启PHP组件和虚拟目录。 去掉在168、169行的#号
|
1 2 |
LoadModule rewrite_module libexec/apache2/mod_rewrite.so LoadModule php5_module libexec/apache2/libphp5.so |
211行前面加上#号
|
1 |
#Require all denied |
修改默认目录
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
DocumentRoot "/Users/wise/site/default" <Directory "/Users/wise/site/default"> # # Possible values for the Options directive are "None", "All", # or any combination of: # Indexes Includes FollowSymLinks SymLinksifOwnerMatch ExecCGI MultiViews # # Note that "MultiViews" must be named *explicitly* --- "Options All" # doesn't give it to you. # # The Options directive is both complicated and important. Please see # http://httpd.apache.org/docs/2.4/mod/core.html#options # for more information. # Options FollowSymLinks Multiviews MultiviewsMatch Any # # AllowOverride controls what directives may be placed in .htaccess files. # It can be "All", "None", or any combination of the keywords: # AllowOverride FileInfo AuthConfig Limit # AllowOverride All # # Controls who can get stuff from this server. # Require all granted </Directory> |
虚拟目录,修改文件/etc/apache2/extra/httpd-vhosts.conf
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
#默认目录 <VirtualHost *:80> DocumentRoot "/Users/wise/site/default" ServerName default </VirtualHost> #工具 <VirtualHost *:80> DocumentRoot "/Users/wise/site/db" ServerName db </VirtualHost> #个人项目 <VirtualHost *:80> DocumentRoot "/Users/wise/site/jinzhe" ServerName jinzhe <Directory "/Users/wise/site/jinzhe"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot "/Users/wise/site/yckit" ServerName yckit <Directory "/Users/wise/site/yckit"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot "/Users/wise/site/dmku" ServerName dmku <Directory "/Users/wise/site/dmku"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> #私人项目 <VirtualHost *:80> DocumentRoot "/Users/wise/site/sms" ServerName sms </VirtualHost> <VirtualHost *:80> DocumentRoot "/Users/wise/site/icrobot" ServerName icrobot <Directory "/Users/wise/site/icrobot"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot "/Users/wise/site/lbdlq" ServerName lbdlq <Directory "/Users/wise/site/lbdlq"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> <VirtualHost *:80> DocumentRoot "/Users/wise/site/baidu" ServerName baidu <Directory "/Users/wise/site/baidut"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> #公司项目 <VirtualHost *:80> DocumentRoot "/Users/wise/site/fishernuts" ServerName fishernuts <Directory "/Users/wise/site/fishernuts"> Options FollowSymLinks AllowOverride All Require all granted </Directory> </VirtualHost> |
3.修改HOSTS文件 在Finder右键点击“前往文件夹”后输入“/etc ”然后打开hosts。
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
#工具 127.0.0.1 db #个人项目 127.0.0.1 jinzhe 127.0.0.1 dmku 127.0.0.1 yckit 127.0.0.1 yckit.api #私单项目 127.0.0.1 sms 127.0.0.1 icrobot 127.0.0.1 lbdlq 127.0.0.1 baidu 127.0.0.1 jcm #公司项目 127.0.0.1 fishernuts |
4.安装MYSQL 到官网下载:http://dev.mysql.com/downloads/mysql/ 选DMG格式的就好了。他会帮你一键安装好。 复制出一份。php.ini
|
1 |
cp /etc/php.ini.default /etc/php.ini |
创建mysql socket(不设置这个无法连接phpmyadmin)
|
1 2 |
sudo mkdir /var/mysql sudo ln -s /tmp/mysql.sock /var/mysql/mysql.sock |
然后修改php.ini中的内容(原因是连接时候php默认去找/var/mysql/mysql.sock了,但是MAC版本的MYSQL改动了文件的位置,放在/tmp下了。)
|
1 |
mysql.default_socket = /tmp/mysql.sock |
设置别名和密码
|
1 2 3 |
alias mysql='/usr/local/mysql/bin/mysql' alias mysqladmin='/usr/local/mysql/bin/mysqladmin' mysqladmin -u root password "123456" |
from:http://jinzhe.net/post/32.html
View Details1. 安装PCRE Download latest PCRE. After download go to download directory from terminal. $ cd ~/Download $ tar xvzf pcre-8.12.tar.gz $ cd pcre-8.12 $ sudo ./configure --prefix=/usr/local $ sudo make $ sudo install 2. 安装Nginx Download latest nginx from Nginx.org. After download, let install $ cd ~/Download $ tar xvzf nginx-1.0.0.tar.gz $ cd nginx-1.0.0 $ sudo ./configure --prefix=/usr/local --with-http_ssl_module --with-ld-opt="-L /usr/local/lib" $ sudo make $ sudo make install 3. 运行Nginx $ cd /usr/local/sbin $ sudo ./nginx 访问http://localhost 4. 关闭Nginx $ cd /usr/local/sbin $ sudo […]
View Details就像其他Unix系统一样,Mac OS X的根目录也是/,Finder中的根目录就是硬盘目录,也就是Macintosh HD。新版本的OS X系统开始隐藏根目录,因为大多数用户不需要访问。下面为大家介绍四种快速访问根目录的方法。 1:通过“前往文件夹”快捷键组合 “前往文件夹”可能是OS X系统Finder中最常用的操作了,用户只需点击左上角的“前往”菜单,然后选择“前往文件夹…”功能。使用快捷键+Shift+G也可以快速激活“前往文件夹”功能,窗口打开后,输入“/”并回车即可。 2:将Macintosh HD快捷方式放入Finder侧边栏 对于经常要访问根目录的用户来说,将Macintosh HD快捷方式会更高效一些。在任何文件夹内(除了“我的所有文件”)右键点击标题栏,然后选择Macintosh HD。最后将Macintosh HD左侧的硬盘图标拖拽至侧边栏即可完成操作。以后需要访问根目录时,只需点击侧边栏的快捷方式即可。 3:在桌面上显示硬盘 打开Finder的“偏好设置”,在“通用”模式下在“硬盘”前面的方块内勾选即可。这样桌面上就会有Macintosh HD,双击即可访问。 4:使用命令行迅速导航 打开终端应用,然后输入下面的命令即可迅速导航至根目录。 cd / 复制代码 上面的命令是在终端中访问根目录,如果你想通过终端打开Finder的根目录,只需下面的命令即可: open / 复制代码 from:http://www.macx.cn/thread-2080254-1-1.html
View Details1. 验证/修复磁盘权限 在 应用程序/实用程序/磁盘工具.app 选择你的系统所在宗卷进行验证,如果有问题则修复(其实也可以直接点“验证并修复磁盘权限”反正修复之前必会先验证的)。 注意非系统宗卷默认是忽略权限的,自然没有验证和修复的说法。 2. 清除不需要的登录项目(就是登录的时候自动运行的程序) 系统预置 – 帐户 – 登录项目,自己看着办,把不需要登录项目减掉。 注意有一些程序即使去掉后还会自动再添加的,比如 Adobe Acrobat 的 AdobeResourceSynchronizer 等。 3. 清除不需要的应用程序 没什么好说的,一些不再用的应用程序可以删掉了,即占空间又碍眼。 4. 清除不需要的预置面板 在系统预置下面的列表中是一些第三方应用程序添加的面板,需要的可以删掉。直接点右键去掉,或者在“~/Library/PreferencePanes”里删除不需要的,可能需要重新启动或者强制清倒废纸篓。 5. 清理桌面 已经有相当多的用户报告说一个干净的桌面可以提升系统运行速度。 别把乱七八糟的东西留在桌面上,找个文件夹收拾起来,或者干脆删除了。 6. 清倒废纸篓 清倒废纸篓可以节省磁盘空间哦~~废话。 7. 如果不需要,就关掉万能辅助 很明显,开着万能辅助肯定会占用内存和处理器时间,关掉用不到的万能辅助选项吧,在系统预置-万能辅助里 8. 如果不需要,关掉蓝牙 开着蓝牙,即费内存又费电,不用的时候关掉吧。用无线MM鼠的用户请忽略。 9. 关掉语音识别 说实话,非英语用户其实开着也是浪费内存和处理器时间。 10. 关闭 Internet 共享 系统预置-共享-Internet,现在用路由器的多, Internet 共享不用就关掉吧。 11. 为启动宗卷(就是系统所在宗卷)预留足够个空闲空间 虚拟内存要用的,所以尽量保证启动宗卷上有10%的空闲空间。 12. 移除不需要的语言包 Monolingual 是个免费的移除语言包的好工具。一些你根本看不懂的语言包去掉就去掉吧,还能省空间。 注意:移除语言包是不可恢复的操作,如果出现问题,必须重装软件才能恢复。请小心决定。 13. 移除改变桌面效果的程序 最近我(指原文作者)发现一个不错的程序可以在每个月在我的桌面上放一个不同小孩,看起来很不错,但一次我在活动监视器里发现这个程序占用了大量了内存和处理器时间。 14. 清理 Dock 上不许要的应用程序 在 Dock 上只需要保留经常使用的应用程序就够了。 15. 为文件关联合适的应用程序 比如图片,如果没有特别要求,最好关联在“预览.app”上,关联在“Photoshop.app”会给每次连按图片文件造成很大的不便。 16. 检查应用程序的架构 如果你使用 Intel-based Mac ,那么用 Universal Binary 版的应用程序将比通过 Rosetta 运行 PowerPC 架构要快。 17. 关掉 Dock 的特效 18. 关掉桌面背景动画 […]
View DetailsWarning: file_put_contents(): Filename cannot be empty 在 file_unmanaged_save_data() (行 1937 在 D:\WEBSITE\dabeizhou.org\includes\file.inc). 文件无法创建。 Warning: file_put_contents(): Filename cannot be empty 在 file_unmanaged_save_data() (行 1937 在 D:\WEBSITE\dabeizhou.org\includes\file.inc). 文件无法创建。 解决方法: 在 管理 >> 配置 >> 媒体 >>文件系统 里面看看你的临时文件路径是什么,是不是有写权限。
View Details你可能已经听说过Windows 10会在默认情况下收集用户的数据,虽然微软声称这是为了提供个人化服务和体验,仍有不少用户对个人数据非常谨慎,不过我们已经发布了如何关闭 Windows 10自动搜索数据的方法。根据外媒on gHacks博文报道,最近微软面向Windows 7和Windows 8.1的新补丁也带来了一些搜集用户数据及追踪操作记录的功能。 涉及这些功能的更新包括KB3068708,KB3022345,KB3075249,KB3080149,均包含了会搜集用户数据的 Diagnostics and Telemetry分析与记录追踪服务,或者UAC自动记录点功能。如何做来关闭这些烦人的用户数据搜集选项?首先你可以避免安装这4个补丁,如果你已经 安装可以通过控制面板卸载这项补丁。或者进入命令行界面输入下列命令来卸载这项补丁。 wusa /uninstall /kb:3068708 /quiet /norestart wusa /uninstall /kb:3022345 /quiet /norestart wusa /uninstall /kb:3075249 /quiet /norestart wusa /uninstall /kb:3080149 /quiet /norestart 并且确保Windows Update更新机制中“隐蔽”这些特定的补丁,以免系统再次尝试下载安装。 from:http://www.oschina.net/news/65699/windows-7-8.1-patch-s-trick
View Details