Nginx配置安装(Mac)
我用到的安装工具是:homebrew 真的很方便!
步骤1:
打开终端,输入
brew info nginx
结果:
我们可以看到,nginx在本地还未安装(Not installed),nginx的来源(From),Docroot默认为/usr/local/var/www,在/usr/local/etc/nginx/nginx.conf配置文件中默认端口被配置为8080从而使nginx运行时不需要加sudo,nginx将在/usr/local/etc/nginx/servers/目录中加载所有文件,以及我们可以通过最简单的命令 ‘nginx’ 来启动nginx。
步骤2:
开始安装 brew install nginx 安装完毕如图所示:
步骤3:
查看nginx安装目录 在finder中shift+command+g输入
/usr/local/etc/nginx/

1.17.2就是我的版本啦

双击nginx启动nginx

这样就开启nginx啦,在safari上输入http://localhost:8080 就可以看到

新建终端窗口输入
nginx -s stop进行快速关闭

nginx的一些常见命令
ps -ef | grep nginx 查看nginx进程
nginx -s quit 优雅关闭(先服务完已打开的连接)
nginx -s stop 快速关闭
了解一下nginx的配置文件吧(nginx.conf)
cat /usr/local/etc/nginx/nginx.conf
#user nobody;
worker_processes 1;
#error_log logs/error.log;
#error_log logs/error.log notice;
#error_log logs/error.log info;
#pid logs/nginx.pid; events {
worker_connections 1024;
} http {
include mime.types;
default_type application/octet-stream;
#log_format main '$remote_addr - $remote_user [$time_local] "$request" '
# '$status $body_bytes_sent "$http_referer" '
# '"$http_user_agent" "$http_x_forwarded_for"';
#access_log logs/access.log main;
sendfile on;
#tcp_nopush on;
#keepalive_timeout 0;
keepalive_timeout 65;
#gzip on;
server {
#侦听8080端口
listen 8080;
#定义使用 localhost访问
server_name localhost;
#charset koi8-r;
#access_log logs/host.access.log main;
location / {
#定义服务器的默认网站根目录位置
root html;
#定义首页索引文件的名称
index index.html index.htm;
}
...
...
... (注释代码太多,就不全部贴出来了)
include servers/*;
}
更多关于nginx配置的干货:
https://www.cnblogs.com/dududududududu/p/11290988.html
Nginx配置安装(Mac)的更多相关文章
- nginx配置安装
先安装pcrepcre作用是让Nginx支持Rewrite功能下载地址:https://sourceforge.net/projects/pcre/files/pcre/,选择最新版本进行下载下载之后 ...
- Linux环境下Nginx配置安装PHP
下边的安装配置方法,我试了一晚上没有成功,可能因为我的系统环境比较复杂,所以建议: 先安装PHP.使用yum命令安装,在安装配置MySQL,具体做法看博客中其他文章,至于Nginx服务器可以安装完这两 ...
- 宝塔面板nginx配置安装Discuz
Discuz!在Nginx下的Rewrite 需要说明的是,下网上以前一直流传的Rewrite都是有误的. 下面的Rewrite中百分号前面多了个转移字符"",这在Apache中是 ...
- centos7 - nginx配置安装phpmyadmin
原文 https://www.linuxidc.com/Linux/2017-10/147556.htm 使用Nginx搭建phpMyAdmin Nginx有什么用? Nginx可读作Engin ...
- Mac安装nginx配置过程
mac电脑系统重装了,记录一下安装nginx的过程: 1.打开终端 2.安装Command Line tools xcode-select --install 3.安装brew命令 ruby -e & ...
- Nginx 的安装配置入门(mac)
1.安装Nginx服务器: 执行命令 brew install nginx 安装完以后,可以在终端输出的信息里看到一些配置路径: /usr/local/etc/nginx/nginx.conf (配置 ...
- Mac直播服务器Nginx配置对HLS的支持
在上一篇中Mac上搭建直播服务器Nginx+rtmp,我们已经搭建了nginx+rtmp直播服务器.下面需要对Nginx服务器增加对HLS的支持.在Nginx增加对HLS种支持比较简单,只是简单的修改 ...
- mac上php+nginx配置
brew的安装: ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”php安装和配置bre ...
- 超详细Nginx的安装和配置教程
一. 编译安装nginx 下载nginx安装包 wget http://nginx.org/download/nginx-1.8.0.tar.gz 也可以选择其他版本,官网:http://nginx. ...
随机推荐
- EhCache注解 (转载)
其实EhCache使用的就是Spring Cache的注解. 1.1 @Cacheable @Cacheable可以标记在一个方法上,也可以标记在一个类上.当标记在一个方法上时表示该方法是支持缓存的, ...
- Fire! UVA - 11624 (两步bfs)
题目链接 题意 人要从迷宫走出去,火会向四个方向同时扩散 分析 两步bfs,先出火到达各地时的时间(设初始时间为0,人每走一步为1s,在着一步内火可以向四周可触及的方向同时扩散),然后在bfs人,人能 ...
- SQLServer性能优化之---数据库级日记监控
上节回顾:https://www.cnblogs.com/dotnetcrazy/p/11029323.html 4.6.6.SQLServer监控 脚本示意:https://github.com/l ...
- 【POJ - 1426】Find The Multiple(dfs)
-->Find The Multiple 原文是英语,直接上中文了 Descriptions: 给定一个正整数n,请编写一个程序来寻找n的一个非零的倍数m,这个m应当在十进制表示时每一位上只包含 ...
- 【机器学习实践】解决Jupyter Notebook中不能正常显示中文标签及负号的方法
import matplotlib.pyplot as plt plt.rcParams['font.sans-serif']=['SimHei'] #用来正常显示中文标签plt.rcParams[' ...
- 对http请求进行过滤处理,转换成接收着需要的格式
需要在Global.asax的Application中进行初始化处理 这样:GlobalConfiguration.Configuration.MessageHandlers.Add(new Defa ...
- spark 源码分析之十四 -- broadcast 是如何实现的?
本篇文章主要剖析broadcast 的实现机制. BroadcastManager初始化 BroadcastManager初始化方法源码如下: TorrentBroadcastFactory的继承关系 ...
- 【POJ - 2676】Sudoku(数独 dfs+回溯)
-->Sudoku 直接中文 Descriptions: Sudoku对数独非常感兴趣,今天他在书上看到了几道数独题: 给定一个由3*3的方块分割而成的9*9的表格(如图),其中一些表格填有1- ...
- 9.18考试 第一题count题解
这道题说起来挺可惜的,当时纠结是用常数大但有可能减少递归层数的模还是用常数小但递归多的回溯纠结了好半天,最终错误的选择了模.导致T了20分,改成回溯就A了. 先分析一下性质,我在考试的时候打表发现在数 ...
- 一个简单的使用mock技术进行测试的例子
Account: public class Account { private String acountId; private long balance; public Account(String ...

