1. 安装PCRE库(Nginx rewrite依赖PCRE库)
下载PCRE: http://www.pcre.org
tar xvzf pcre-8.37.tar.gz cd pcre-8.37 sudo ./configure --prefix=/usr/local sudo make sudo make install
2. 安装Nginx
下载Nginx: http://nginx.org
tar xvzf nginx-1.8.0.tar.gz cd nginx-1.8.0 sudo ./configure --prefix=/usr/local/nginx --with-http_ssl_module --with-cc-opt="-Wno-deprecated-declarations" sudo make sudo make install
编译概要:
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 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"
3. 配置环境变量:
sudo vi ~/.bash_profile # Append content to bash_proflie export PATH=/usr/local/nginx/bin:/usr/local/nginx/sbin:$PATH source ./bash_profile
4. 配置Nginx开机启动:
cd /System/Library/LaunchDaemons sudo touch nginx.plist sudo vi 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"> <dict> <key>Label</key> <string>nginx</string> <key>KeepAlive</key> <true/> <key>Program</key> <string>/usr/local/bin/nginx</string> <key>RunAtLoad</key> <true/> </dict> </plist>
载入Nginx开机启动文件
launchctl load -w /System/Library/LaunchDaemons/nginx.plist
5. 启动:
sudo nginx
停止:
sudo nginx -s stop
重启:
sudo nginx -s reload
相关推荐
一、nginx 安装与运行 (Mac OS环境) 1. 安装 nginx 可通过 Homebrew 可直接安装: $brew install nginx 安装好后,默认首页的文件在 /usr/local/var/www 文件夹下 默认的配置文件地址在 /usr/local/etc/nginx/nginx...
/usr/local/etc/nginx/nginx.conf (配置文件路径) /usr/local/var/www (服务器默认路径) /usr/local/Cellar/nginx/1.6.2 (貌似是安装路径) 二、访问localhost:8080 Nginx 默认8080端口,这时已经可以访问了:...
mac下使用homebrew安装安装、配置nginx、mysql、php-fpm的方法。
Mac php72+nginx环境配置.txt
PPT文件是用mac电脑Keynote做的PPT,主要讲解了nginx的入们和一些常用配置,nginx做负载均衡很常用。有兴趣的朋友可以下载看一下。。
目录 介绍Nginx 正向代理 正向代理配置 反向代理 反向代理配置 介绍Nginx Nginx是一款自由的、开源的、...Nginx是一个跨平台服务器,可以运行在Linux,Windows,FreeBSD,Solaris,AIX,Mac OS等操作系统上 稳定性极高
本地开发有时候需要调试静态文件资源,无法直接访问,可以通过配置本地Nginx服务的方式来进行,顺便记录一下Nginx的配置步骤 安装 <!--通过 Brew 安装: --> brew install nginx <!--启动: --> brew ...
如果您具有更高级的配置,需要nginx写入其他位置,只需将更多的卷安装添加到这些位置。 在调试模式下运行Nginx 自1.9.8版起的图像带有nginx-debug二进制文件,当使用较高的日志级别时,该文件会产生详细的输出。...
Nginx 目前来说已经很流行了,所以打算把现有的Apache先替换一部分,在批量部署和管理方面都要考虑到。因为nginx的所有模块都是静态编译的不像apache那样可以动态添加模块,所以在一开始就要... Nginx安装方法: 1
nginx 1.24.0 ,自带服务化配置,使用简单
本文的主要内容是在不同的操作系统下配置Nginx和SSL,并且搭建一个Node.js运行环境。 安装Nginx 假设你已经在服务器上安装了Node.js,下面我们来安装Nginx。 在Mac系统上安装Nginx 利用chown命令来获取访问/usr/...
Mamp for mac pro 如何配置虚拟域名详细步骤,或者如何配置多站点访问,只要按照步骤来,绝对OK没问题。
Nginx的[ X ]是一个HTTP引擎和反向代理服务器,邮件代理服务器,和...更多关于“Nginx的基础入门篇”、“下载及安装步骤命令”、“完整配置调试教程和实例”、“性能优化技巧”等请参加在线电子教程“Nginx配置大全”。
主要介绍了在Mac OS上安装配置Nginx+PHP+MySQL开发环境的教程,虽然Mac自带PHP,但还是要注意一下php-fpm报错问题的发生,需要的朋友可以参考下
/usr/local/etc/nginx/nginx.conf (配置文件路径) /usr/local/var/www (服务器默认路径) /usr/local/Cellar/nginx/1.8.0 (安装路径) 如果是macOS 1.12以上的系统,在安装过程中可能会出现”warning”,说是不...
Vagrant 是用来管理虚拟机的...以及启动后自动执行一些配置脚本,如自动执行一个 Shell Script 来安装一些必备的开发工具,如安装配置MySQL、PHP,甚至是自动配置 Nginx 站点。.vagrant用于管理virtualbox,方便,高效