欢迎来到天天文库
浏览记录
ID:17570972
大小:36.50 KB
页数:4页
时间:2018-09-03
《macos下用port安装nginx搭建php环境》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、MacOS下用Port安装nginx搭建PHP环境驱动:http://bbs.pcbeta.com/viewthread-936053-1-1.htmlDSDT:http://bbs.pcbeta.com/viewthread-947666-1-1.htmlmacport下载地址安装porthttp://www.macports.org/install.php安装之前请先下载Xcode4.2lion。根据里面的说明安装MacProt即可。接下来安装nginx在Mac上使用macport安装和配置Nginx非
2、常方便,首先安装nginxsudoportinstallnginxspawn-fcgi安装完成后启动nginx会说没有nginx.conf文件,到/opt/local/etc/nginx目录下看到以下几个文件:fastcgi_params.examplekoi-utfkoi-winmime.types.examplenginx.conf.examplewin-utf直接复制example文件:sudomvmime.types.examplemime.typessudomvnginx.conf.example
3、nginx.conf启动nginx:sudonginx访问http://127.0.0.1/,就可以看到Nginx的Welcome页面。如何重启nginx?#检测配置文件是否有效sudonginx-t#重启sudonginx-sreload#帮助sudonginx-h默认的nginx配置不是很好用,下面调整一下cd/opt/local/etc/nginx/sudomkdirconf.dsudomkdirsites-availablesudomkdirsites-enabled文件nginx.conf的配置h
4、ttp部分:http{includemime.types;default_typeapplication/octet-stream;log_formatmain'$remote_addr-$remote_user[$time_local]"$request"''$status$body_bytes_sent"$http_referer"''"$http_user_agent""$http_x_forwarded_for"';access_loglogs/access.logmain;sendfileon;t
5、cp_nopushon;keepalive_timeout10;#keepalive_timeout65;gzipon;include/opt/local/etc/nginx/conf.d/*.conf;include/opt/local/etc/nginx/sites-enabled/*;}然后站点配置文件放在目录sites-available里,在目录sites-enabled中做ln-s../sites-available/xxx.conf./即可php5安装php5,扩展模块根据自己的需要调整#su
6、doportinstallphp5+fastcgifcgiphp5-gdphp5-mysqlphp5-sqlitephp5-eacceleratorphp5-curlphp5-iconv#配置文件cd/opt/local/etc/php5sudocpphp.ini-developmentphp.ini将时区修改为:date.timezone=Asia/Chongqing错误级别修改为:error_reporting=E_ALL&~E_NOTICEphp-fcgicd/Library/LaunchDaemon
7、s/sudovimorg.macports.phpfcgi.plist文件org.macports.phpfcgi.plist内容如下:Labelorg.ma
8、cports.phpfcgiDebugOnDemandRunAtLoadEnvironmentVariablesPHP_FCGI_CHILDREN2PHP_FCGI_MAX_REQUE
此文档下载收益归作者所有