您的位置:首页 > 数据库 > Redis

MAC OS X 10.9 下 Nginx的安装笔记(为后续搞Nginx+Redis+Tomcat集群做准备)

2014-08-29 10:56 645 查看
Nginx的强大不必说了,必须要用,搞起!!

1,先安装PCRE库,这个是Nginx rewrite 反向代理需要依赖的正则表达式库

我下载的是8.33版本,www.pcre.org

下载在/opt/pcre-8.33.tar.gz 执行:如下命令

cd ~/opt
tar xvzf pcre-8.33.tar.gz
cd pcre-8.33
sudo ./configure --prefix=/usr/local
sudo make
sudo make install


2,下载安装Nginx
我这里采用 nginx-1.5.2 下载地址:http://nginx.org/download/nginx-1.5.2.tar.gz
同样存放在/opt下,然后执行:

tar -zvxf nginx-1.5.2.tar.gz
cd nginx-1.5.2
安装前配置

./configure
--prefix=/usr/local
--sbin-path=/usr/local/sbin
--conf-path=/etc/nginx
--pid-path=/var/run
--error-log-path=/var/log/nginx
--http-log-path=/var/log/nginx


然后编译和安装

make
make instal
编译后的一些日志

Configuration summary
+ using system PCRE library
+ OpenSSL library is not used
+ md5: using system crypto library
+ sha1: using system crypto library
+ using system zlib library

# 默认编译参数对应的安装路径(*_temp 为目录)
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"


接下来

~/.bash_profile export PATH=/usr/local/bin:/usr/local/sbin:$PATH

如果发现

.bash_profile文件不存在,则touch.bash_profile新建,然后vim编辑设置环境变量即可

ok,最后一步  来到 /usr/local/nginx/sbin下
执行 sudo nginx   启动Nginx 搞定
默认端口是80
打开浏览器 http://localhost/[/code] 
搞定了! 初步安装好,还需要后续的配置。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: