ITeye博客

mac 上安装nginx

stephen830 · 2014-01-10 10:29 · nginx · 互联网 · Markdown

由于会用到gcc编译,本机已经装过xcode,因此已经有了gcc。

检测是否装过gcc:  gcc -v

 

 

1. 安装PCRE

 

下载最新的 PCRE. ,是perl类库,这是用于nginx的rewrite规则解析。

pcre-8.34.tar

解压后

cd ~

cd pcre-8.34

sudo ./configure --prefix=/usr/local 

sudo make

sudo make install

 

2. 安装nginx

下载最新的 nginx 从网站 Nginx.org. 

nginx-1.5.8.tar

解压后

cd ~

cd nginx-1.5.8

sudo ./configure --prefix=/usr/local/nginx-1.5.8 --with-http_ssl_module --with-ld-opt="-L /usr/local/lib"

sudo make

sudo make install

 

至此,nginx已经安装完毕,下面启动验证下。

 

启动nginx

cd /usr/local/sbin

sudo ./nginx

 

打开浏览器访问 http://localhost

 

关闭nginx

 

sudo ./nginx -s stop

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。