当前位置: > Linux服务器 > nginx >

如何在MacOS X上配置Nginx

时间:2015-10-06 23:02来源:linux.it.net.cn 作者:IT
  • 前提条件:
  • How to Configure and Install Nginx on Mac OS X
  • 安装Nginx:

前提条件:

安装Xcode中的命令行工具

参考原文:

How to Configure and Install Nginx on Mac OS X

安装Nginx:

1. 下载最新版本的Nginx – nginx 1.4.7

2. 解压 “tar xvzf nginx-1.4.7.tar.gz”

3. “cd nginx-1.4.7″

4. “sudo ./configure”. 这个时候会出现错误:

1
2
3
4
5
6
7
./configure: error: the HTTP rewrite module requires the PCRE library.
 
You can either disable the module by using --without-http_rewrite_module
 
option, or install the PCRE library into the system, or build the PCRE library
 
statically from the source with nginx by using --with-pcre=<         path         > option.

5. 阅读一下官网指南“Building nginx from Sources”,需要下载PCRE

6. 到PCRE官网下载最新的PCRE库

7. 下载之后解压 “tar xvzf pcre-8.34.tar.bz2″

8. 现在再次带参数运行 ”sudo ./configure –with-pcre=path”

9. 配置完成。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
nginx path prefix: "/usr/local/nginx"
 
nginx binary file: "/usr/local/nginx/sbin/nginx"
 
nginx configuration prefix: "/usr/local/nginx/conf"
 
nginx configuration file: "/usr/local/nginx/conf/nginx.conf"
 
nginx pid file: "/usr/local/nginx/logs/nginx.pid"
 
nginx error log file: "/usr/local/nginx/logs/error.log"
 
nginx http access log file: "/usr/local/nginx/logs/access.log"
 
nginx http client request body temporary files: "client_body_temp"
 
nginx http proxy temporary files: "proxy_temp"
 
nginx http fastcgi temporary files: "fastcgi_temp"
 
nginx http uwsgi temporary files: "uwsgi_temp"
 
nginx http scgi temporary files: "scgi_temp"<         i         > </         i         >

默认路径 “/usr/local/nginx”.

10. 安装nginx, 输入“sudo make install”.

11. 找到可执行文件 “cd /usr/local/nginx/sbin”

12. 运行Nginx “sudo ./nginx”


(责任编辑:IT)
------分隔线----------------------------
栏目列表
推荐内容