- 浏览: 73584 次
- 性别:
- 来自: 上海
最新评论
<!--?xml version="1.0" encoding="UTF-8" standalone="no"?-->
Install Nginx And PHP-FPM On Mac Lion
安装Nginx
方法1:使用brew.
brew install nginx
按提示操作,安装完成后nginx的配置文件在/usr/local/etc/nginx/nginx.conf。
启动nginx:
nginx 或者 sudo nginx
注意:若nginx的监听端口为1024以下,则需要使用sudo,否则会出现Permission denied.
停止 nginx
(sudo)nginx
-s
stop
自动启动
You can start nginx automatically on login running as your user with:
mkdir -p ~/Library/LaunchAgents
cp /usr/local/Cellar/nginx/1.0.8/org.nginx.nginx.plist ~/Library/LaunchAgents/
launchctl load -w ~/Library/LaunchAgents/org.nginx.nginx.plist
禁止自动启动
launchctl unload -w ~/Library/LaunchAgents/org.nginx.nginx.plist
rm ~/Library/LaunchAgents/org.nginx.nginx.plist
方法2:下载源码编译
cd ~/SourceCache
curl -O http://nginx.org/download/nginx-1.0.4.tar.gz
tar -xzf nginx-1.0.4.tar.gz
cd nginx-1.0.4
brew install pcre
./configure --prefix=/usr/local/nginx --pid-path=/usr/local/nginx/var/run/nginx.pid --with-http_ssl_module
make
sudo make install
自动启动
sudo nano /Library/LaunchDaemons/org.nginx.nginx.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">z
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>org.nginx.nginx</string>
<key>LaunchOnlyOnce</key>
<true/>
<key>NetworkState</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/nginx/sbin/nginx</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceDescription</key>
<string>Nginx web server</string>
<key>StandardErrorPath</key>
<string>/var/log/system.log</string>
</dict>
</plist>
配置nginx
sudo mkdir /usr/local/etc/nginx/sites-available
sudo mkdir /usr/local/etc/nginx/sites-enable
sudo nano /usr/local/etc/nginx/nginx.conf
在
http{
…
server{
...
}
include sites-enabled/*.conf;
sudo nano /usr/local/nginx/conf/php.conf
fastcgi_intercept_errors on;
location ~ \.php$
{
fastcgi_split_path_info ^(.+\.php)(/.+)$;
fastcgi_param PATH_INFO $fastcgi_path_info;
fastcgi_param PATH_TRANSLATED $document_root$fastcgi_path_info;
fastcgi_param QUERY_STRING $query_string;
fastcgi_param REQUEST_METHOD $request_method;
fastcgi_param CONTENT_TYPE $content_type;
fastcgi_param CONTENT_LENGTH $content_length;
fastcgi_param SCRIPT_NAME $fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param REQUEST_URI $request_uri;
fastcgi_param DOCUMENT_URI $document_uri;
fastcgi_param DOCUMENT_ROOT $document_root;
fastcgi_param SERVER_PROTOCOL $server_protocol;
fastcgi_param GATEWAY_INTERFACE CGI/1.1;
fastcgi_param SERVER_SOFTWARE nginx;
fastcgi_param REMOTE_ADDR $remote_addr;
fastcgi_param REMOTE_PORT $remote_port;
fastcgi_param SERVER_ADDR $server_addr;
fastcgi_param SERVER_PORT $server_port;
fastcgi_param SERVER_NAME $server_name;
fastcgi_read_timeout 600; # Set fairly high for debugging
fastcgi_pass 127.0.0.1:9001; # Non-default port
fastcgi_index index.php;
}
sudo nano /usr/local/nginx/conf/sites-available/example.conf
server
{
listen 80;
server_name example.local;
root /Users/collin/Sites/example/public;
access_log /Users/collin/Sites/example/logs/access_log.txt;
error_log /Users/collin/Sites/example/logs/error_log.txt;
location /
{
index index.php;
try_files $uri $uri/ /index.php?q=$uri&$args;
}
include php.conf;
}
安装PHP PHP-FPM
下载源码
curl -O http://us2.php.net/distributions/php-5.3.6.tar.gz
tar -xzf php-5.3.6.tar.gz
cd php-5.3.6
编译
./configure --prefix=/usr/local/php \
--mandir=/usr/share/man \
--infodir=/usr/share/info \
--sysconfdir=/private/etc \
--enable-cli \
--with-config-file-path=/usr/local/php/etc \
--with-libxml-dir=/usr \
--enable-xml \
--with-openssl=/usr \
--with-kerberos=/usr \
--with-zlib=/usr \
--enable-bcmath \
--with-bz2=/usr \
--enable-calendar \
--with-curl=/usr \
--enable-exif \
--enable-ftp \
--with-gd \
--with-jpeg-dir=/usr/local/Cellar/jpeg/8c/lib \
--with-png-dir=/usr/X11 \
--enable-gd-native-ttf \
--with-ldap=/usr \
--with-ldap-sasl=/usr \
--enable-magic-quotes \
--enable-mbstring \
--enable-mbregex \
--enable-json \
--with-mysql=mysqlnd \
--with-mysqli=mysqlnd \
--with-pdo-mysql=mysqlnd \
--with-mysql-sock=/tmp/mysql.sock \
--with-iodbc=/usr \
--enable-shmop \
--with-snmp=/usr \
--enable-soap \
--enable-sockets \
--with-sqlite \
--enable-sysvmsg \
--enable-sysvsem \
--enable-sysvshm \
--enable-wddx \
--enable-fpm \
--with-mhash \
--with-mcrypt \
--with-xmlrpc \
--enable-xmlwriter \
--enable-xmlreader \
--with-iconv-dir=/usr \
--with-xsl=/usr \
--enable-zend-multibyte \
--enable-zip \
--with-pcre-regex=/usr \
--with-pdo-sqlite \
--enable-pdo \
--enable-dba \
--with-freetype-dir=/usr/X11 \
--enable-dom \
--enable-gd-native-ttf \
--enable-posix \
--enable-fileinfo
make
sudo make install
配置PHP&PHP-FPM
sudo cp /private/etc/php-fpm.conf.default /private/etc/php-fpm.conf
sudo nano /private/etc/php-fpm.conf
[global]
pid = /usr/local/php/var/run/php-fpm.pid
daemonize = yes
[www]
listen = 127.0.0.1:9000
user = ray
group = staff
pm = dynamic
pm.max_children = 10
pm.start_servers = 5
pm.min_spare_servers = 5
pm.max_spare_servers = 10
pm.max_requests = 500
sudo mkdir /usr/local/php/etc
sudo cp /private/etc/php.ini.default /usr/local/php/etc/php.ini
自动启动php-fpm
sudo nano /Library/LaunchDaemons/net.php.php-fpm.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>KeepAlive</key>
<true/>
<key>Label</key>
<string>net.php.php-fpm</string>
<key>LaunchOnlyOnce</key>
<true/>
<key>NetworkState</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/usr/local/php/sbin/php-fpm</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceDescription</key>
<string>PHP FastCGI Process Manager</string>
<key>StandardErrorPath</key>
<string>/var/log/system.log</string>
</dict>
</plist>
停止php-fpm
sudo kill `cat /usr/local/php/var/run/php-fpm.pid`
启动 php-fpm
sudo /usr/local/php/sbin/php-fpm.dSYM发表评论
-
Magento随机生成sales rule的coupon code
2013-01-02 22:09 2274在Magento中可以使用SalesRule模块下的Mage_ ... -
Magento 后台配置中实现日期选择 (Date picker)
2012-12-28 15:07 2514首先,创建一个新的Form Field 类: <?p ... -
获得指定customer 购买的产品数据
2011-12-10 20:54 1376获得指定customer 购买的产品信息,如果是configu ... -
将缺货产品放在产品列表后面
2011-12-10 20:50 1402Rewrite Mage_Catalog_Model_Laye ... -
How to customize Magento as CMS system (1.5.0 CE)
2011-03-06 22:42 1068Before install: 1. Go to app/et ... -
How to redirect to another url in block or template
2011-02-25 13:47 1136In Block class: public funct ... -
Use call back function to proccess Magento large collection
2011-01-19 12:58 949$orders = Mage::getModel('sal ... -
How to remove unnecessary columns in Magento collection
2011-01-19 12:56 1140$orders = Mage::getModel('sal ... -
How to calculate currency according to reward points rate in Magento
2011-01-13 18:03 1339$rate = Mage::getModel('enter ... -
Magento二次开发的利器:Rewrite
2010-12-08 17:15 2742Magento是一个十分优秀的电子商务系统,但是有时候我们需要 ... -
增加Magento后台管理功能三:在后台设置(System/Configuration)中加入自定义设置
2010-11-30 16:17 1981在模块的etc目录下新建system.xml配置文件,内容如下 ... -
增加Magento后台管理功能二:开发后台Controller
2010-11-30 16:02 2714在模块的controllers目录下创建Adminhtml目录 ... -
增加Magento后台管理功能一:在后台管理界面加入菜单
2010-11-30 15:47 4543在模块的etc目录下增加adminhtml.xml配置文件,用 ... -
Magento在CMS Page中增加用户信息变量
2010-11-26 10:14 2836Magento的cms页面和static block页面中可以 ... -
Magento根据不同的浏览器自动切换package或 theme
2010-11-26 10:05 2077在后台设置中: System > Configurat ... -
Magento让后台数据列表中的action列链接在新窗口打开
2010-11-08 16:56 1169'actions' => array( ... -
Maegen获得后台当前用户的信息
2010-11-08 16:53 930$admin = Mage::getSingleton(' ... -
Magento中用子类替换Block
2010-10-15 10:47 1861Step 1:创建一个新的Module Step 2: 编辑模 ... -
Magento中添加带有选项的属性
2010-10-14 14:49 1459下面的代码为Customer实体添加了性别属性,有两个可选值 ... -
Magento为后台用户保存操作日志(企业版)
2010-09-19 17:00 2770protected function _logAdm ...
相关推荐
docker-compose-nginx-phpfpm-源码.rar
下载后,在编译安装nginx时,用--add-module选项,指到sticky所在目录。类似命令如下: ./configure --prefix=/usr/local/nginx-1.6.0 --add-module=../nginx-sticky-module-1.25 --without-...
在NanoPC-T2上安装Nginx和PHP5-FPM,你需要执行以下步骤: 1. 更新系统: ```bash sudo apt-get update sudo apt-get upgrade ``` 2. 安装依赖: 在安装Nginx和PHP5-FPM之前,确保系统拥有所有必要的依赖。这...
docker-compose php7.3.4-fpm+nginx+mysql配置
- 通过配置`fastcgi_pass`指令,Nginx将PHP请求传递给PHP-FPM处理,然后返回结果给客户端。 7. **安全与日志管理** - Nginx的日志文件通常位于`/var/log/nginx/`,通过分析这些日志,可以监控服务器状态、识别...
php-fpm。放到/etc/init.d/目录。然后执行:chmod a+x php-fpm 然后就可以/etc/init.d/php-fpm start 或者systemctl start php-fpm
6. 编译和安装:执行`make`和`make install`命令来编译和安装Nginx。对于Windows,你可能需要使用Visual Studio或其他Windows兼容的编译工具。 7. 测试和启动:编译完成后,你可以通过`./objs/nginx -t`测试配置...
以下是如何在Fedora 15上安装和配置这些组件的详细步骤: 1. **安装MySQL**: - 使用`yum`命令安装MySQL服务器和客户端:`yum install mysql mysql-server` - 配置MySQL随系统启动:`systemctl enable mysqld` -...
通过在 Nginx 的 configure 脚本中添加模块路径,然后执行 `make` 和 `make install` 进行编译和安装。 4. **配置文件** 在 `conf` 目录下的 `nginx.conf` 文件是 Nginx 的主配置文件,其中需要添加或修改部分配置...
Windows 下使用 RunHiddenConsole 启动 nginx、php-fpm, https://www.nginx.com/resources/wiki/start/topics/examples/phpfastcgionwindows/
在Windows平台上编译Nginx并添加HTTP FLV模块是一项技术性较强的工作,涉及到网络服务器配置、编译环境搭建以及第三方模块集成等多个方面。这里我们将深入探讨如何在Windows上完成这个任务,以及与之相关的知识点。 ...
nginx-php-fpm-docker
基于alpine的php-fpm nginx docker一键环境 可以手动替换所有版本 通过修改dockerfile,支持容器加载代码,或者挂载代码 也可以支持k8s做为基础环境容器,整体已经经过优化
nginx+php-fpm解决502 Bad Gateway.zip
a)在server1 上安装配置 nginx + nginx_upstream_jvm_route - 22 - b)分别在两台机器上 安装 resin - 22 - c)配置两台机器 的 resin - 23 - d)整合 ngxin resin - 24 - e)测试,打开浏览器,输入 ...
【php-fpm.rpm包】是专门为Linux系统设计的一款软件包,它包含了PHP-FPM(FastCGI Process Manager)服务,是PHP的一个重要...正确安装和配置php-fpm,结合合适的Web服务器,可以构建出强大且高效的Web应用程序平台。
--> nginx-1.21.6 ======================== 在网上查找半天都只有教程,没有可免费下载的版本,深知没有积分遍地找资源的痛苦,无奈之下只好自己按照教程一步一个坑编译出来的,供大家免费下载使用。(无毒放心使用...
本教程将详细介绍如何在`CentOS 5.2`操作系统上,通过源码安装`Nginx`、`PHP-FPM`,并实现`HTTP Push`功能,以及如何进行测试验证。 首先,让我们了解这些技术的基本概念: 1. **Nginx**:Nginx是一款高性能的HTTP...
将 Nginx Upload Module 的源代码复制到 Nginx 源代码目录,并配置、编译和安装: ```bash cp -r ../nginx-upload-module-2.3.0 nginx-1.21.x/ cd nginx-1.21.x/ ./configure --add-module=../nginx-upload-module...
1. **Nginx 安装与配置**:首先,我们需要安装编译 Nginx 所需的依赖库,如 pcre, openssl, zlib 等。接着,解压 nginx-1.16.1.tar.gz,进入目录并执行 configure 脚本,配置编译选项,确保包含对 nginx-upload-...