nginx安装

brew search nginx

brew install nginx

安装完以后,可以在终端输出的信息里看到一些配置路径:

/usr/local/etc/nginx/nginx.conf (配置文件路径)

/usr/local/var/www (服务器默认路径)

/usr/local/Cellar/nginx/1.8.0 (安装路径)

访问localhost:8080,成功说明安装好了

配置

#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;

upstream mytomcats {

#weigth参数表示权值,权值越高被分配到的几率越大

server 192.168.1.250:8080 weight=5;

#server 192.168.1.250:8080 weight=1;

#server 192.168.1.250:8090 weight=6;

}

server {

listen       8081;

server_name  localhost;

root         /Users/ping/workspace/java/apache-tomcat-8.0.37/webapps/mybatis;

#charset koi8-r;

#access_log  logs/host.access.log  main;

#location / {

#    root   /Users/ping/workspace/java/apache-tomcat-8.0.37/webapps/mybatis;

#    index  /Users/ping/workspace/java/apache-tomcat-8.0.37/webapps/mybatis/index.html;

#}

location /static/ {

alias /Users/ping/workspace/java/apache-tomcat-8.0.37/webapps/mybatis/static/;

}

location ~ (\.jsp)|(\.do)$ {

proxy_pass http://mytomcats;

proxy_redirect off;

proxy_set_header Host $host;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

client_max_body_size 10m;

client_body_buffer_size 128k;

proxy_connect_timeout 90;

proxy_send_timeout 90;

proxy_read_timeout 90;

proxy_buffer_size 4k;

proxy_buffers 4 32k;

proxy_busy_buffers_size 64k;

proxy_temp_file_write_size 64k;

}

#error_page  404              /404.html;

# redirect server error pages to the static page /50x.html

#

error_page   500 502 503 504  /50x.html;

location = /50x.html {

root   html;

}

# proxy the PHP scripts to Apache listening on 127.0.0.1:80

#

#location ~ \.php$ {

#    proxy_pass   http://127.0.0.1;

#}

# pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000

#

#location ~ \.php$ {

#    root           html;

#    fastcgi_pass   127.0.0.1:9000;

#    fastcgi_index  index.php;

#    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;

#    include        fastcgi_params;

#}

# deny access to .htaccess files, if Apache's document root

# concurs with nginx's one

#

#location ~ /\.ht {

#    deny  all;

#}

}

# another virtual host using mix of IP-, name-, and port-based configuration

#

#server {

#    listen       8000;

#    listen       somename:8080;

#    server_name  somename  alias  another.alias;

#    location / {

#        root   html;

#        index  index.html index.htm;

#    }

#}

# HTTPS server

#

#server {

#    listen       443 ssl;

#    server_name  localhost;

#    ssl_certificate      cert.pem;

#    ssl_certificate_key  cert.key;

#    ssl_session_cache    shared:SSL:1m;

#    ssl_session_timeout  5m;

#    ssl_ciphers  HIGH:!aNULL:!MD5;

#    ssl_prefer_server_ciphers  on;

#    location / {

#        root   html;

#        index  index.html index.htm;

#    }

#}

include servers/*;

}

简单命令

nginx -s quit 退出

nginx -s reload 重新加载

nginx -t 测试nginx.conf配置

Mac下nginx安装和配置的更多相关文章

  1. Mac下Maven安装与配置

    Mac下Maven安装与配置 下载maven http://maven.apache.org/download.cgi main->download菜单下的Files 下载后解压在Documen ...

  2. centos7系统下nginx安装并配置开机自启动操作

    准备工作 我的centos7系统是最小化安装的, 缺很多库, 首先安装必须的运行库 ? 1 2 3 4 5 6 7 8 9 10 11 yum install wget gcc gcc-c++ pcr ...

  3. windows下nginx安装、配置与使用(转载)

    目前国内各大门户网站已经部署了Nginx,如新浪.网易.腾讯等:国内几个重要的视频分享网站也部署了Nginx,如六房间.酷6等.新近发现Nginx 技术在国内日趋火热,越来越多的网站开始部署Nginx ...

  4. windows下nginx安装、配置与使用

    目前国内各大门户网站已经部署了Nginx,如新浪.网易.腾讯等:国内几个重要的视频分享网站也部署了Nginx,如六房间.酷6等.新近发现Nginx 技术在国内日趋火热,越来越多的网站开始部署Nginx ...

  5. Centos下 Nginx安装与配置

    网上找了好多资料.都很难找全,这里以这个目录为主,进行备注. Nginx是一款轻量级的网页服务器.反向代理服务器.相较于Apache.lighttpd具有占有内存少,稳定性高等优势.它最常的用途是提供 ...

  6. Mac下Git安装及配置

    Mac下: 1.下载git版本并安装 运行终端 查看git版本: bogon:~ yan$ git --version git version 2.16.3 配置gitconfig文件 vim ~/. ...

  7. centos下Nginx安装和配置多个域名的虚拟主机

    nginx安装步骤,源码编译安装(源码编译,可以自定制更多功能) openssl #user nobody; worker_processes ; #error_log logs/error.log; ...

  8. linux下nginx安装、配置实战

    1什么是Nginx Nginx("enginex")是一个高性能的HTTP和反向代理服务器,也是一个IMAP/POP3/SMTP代理服务器,在高连接并发的情况下Nginx是Apac ...

  9. Mac 下 Mosquitto 安装和配置 (Mosquitto为开源的mqtt服务器)

    官网:http://mosquitto.org/download/ 官网的介绍简单明了 Mac 下一个命令“brew install mosquitto” 安装成功了,还学会了brew 安装目录:/u ...

随机推荐

  1. 2016.6.20 tomcat端口始终被占用

    我在使用tomcat7时,服务开启时,始终提示端口被占用. 但是从进程中又看不到开启的tomcat. 最后在资源监视器中,结束重复开启的tomcat. (注意是资源监视器,刚开始的时候看成管理器,怎么 ...

  2. [Tools] Create a Simple CLI Tool in Node.js with CAC

    Command-line tools can help you with all sorts of tasks. This lesson covers the very basics of setti ...

  3. JNI 函数注册与管理

    class<--> 一一对应so-->method     每个so对应于一个类对象 类中的每个native方法对应 于so中的一个native的function,对应关系涉及 {c ...

  4. Linux学习笔记 (一)初识linux

    一.什么是Linux Linux是一套免费使用和自由传播的类Unix操作系统,是一个基于POSIX和UNIX的多用户.多任务.支持多线程和多CPU的操作系统.它能运行主要的UNIX工具软件.应用程序和 ...

  5. 《Microsoft Sql server 2008 Internals》读书笔记--第六章Indexes:Internals and Management(1)

    <Microsoft Sql server 2008 Internals>索引文件夹: <Microsoft Sql server 2008 Internals>读书笔记--文 ...

  6. Java 过滤所有html标签,复制文件到指定位置

    public static String filterHtml(String string) { String str = string.replaceAll("<[a-zA-Z]+[ ...

  7. zabbix监控第二块网卡是否连通

    配置zabbix客户端配置文件 vim /etc/zabbix/zabbix_agentd.conf 添加  Include=/etc/zabbix/zabbix_agentd.d/ 添加脚本检测网卡 ...

  8. 网络配置ipconfig /release、ipconfig /renew

    换了一个工位,换了一根网线,网络就不能用了,网线插在别人电脑上能用,我很是纳闷,这是哪里出问题了呢?通过进入CMD命令操作框,输入以下命令,重新分配IP成功解决问题,耶 ping: ping 的作用是 ...

  9. 会话管理之Cookie技术

    会话管理是web开发中比较重要的环节,这一节主要总结下会话管理中的cookie技术. 1. 何为会话 会话可简单理解为:用户开一个浏览器,点击多个超链接,访问服务器多个web资源,然后关闭浏览器,整个 ...

  10. Android 完整开源应用大全,完整开源项目

    (Antox)聊天的  (new) (OpenKeychain)OpenPGP在android上的实现  (new) (Flock)提供同步服务 (OpenFlappyBird)以前火爆的坑爹鸟 (F ...