前言:

参考 https://blog.csdn.net/kisscatforever/article/details/73129270

Nginx的应用场景
      1、 http服务器。Nginx是一个http服务可以独立提供http服务。可以做网页静态服务器。

2、 虚拟主机。可以实现在一台服务器虚拟出多个网站。例如个人网站使用的虚拟主机。

基于端口的,不同的端口
            基于域名的,不同域名
      3、 反向代理,负载均衡。当网站的访问量达到一定程度后,单台服务器不能满足用户的请求时,需要用多台服务器集群可以使用nginx做反向代理。并且多台服务器可以平均分担负载,不会因为某台服务器负载高宕机而某台服务器闲置的情况。

1、到官网下载nginx安装包。如下图所示(建议安装稳定版本):

2、解压安装包,如下图所示:

3、开始安装(建议用cmd命令执行安装)

1)定位到加压文件根目录:cd C:\nginx-1.14.0

2)安装:C:\server\nginx-1.14.0>start nginx

4、其他命令

停止:C:\server\nginx-1.14.0>nginx.exe -s stop

重新载入Nginx:C:\server\nginx-1.14.0>nginx.exe -s reload

查看Nginx版本:C:\server\nginx-1.14.0>nginx -v

========================配置nginx文件(以下为本地案例)===========================

 #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 {
listen 88;
server_name 127.0.0.1; #charset koi8-r;
proxy_set_header Host 127.0.0.1:88;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
#access_log logs/host.access.log main; location ^~ /ProxyService/ { proxy_set_header Host $host; proxy_pass http://127.0.0.1:8067/; }
location ^~ /ph/ { proxy_set_header Host $host; proxy_pass http://127.0.0.1:8091/; }
location ^~ /report/ { proxy_set_header Host $host; proxy_pass http://127.0.0.1:90/; } location ^~ /admin/ { proxy_pass http://127.0.0.1:88/; } #其他路径默认访问前台网站
location / {
proxy_redirect off;
proxy_pass http://WeixinRespon;
proxy_set_header HOST $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
} #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;
#}
} upstream WeixinRespon {
server 127.0.0.1:8080;
} # 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;
# }
#} }

win10环境安装配置Nginx的更多相关文章

  1. linux环境安装配置nginx

    安装依赖 yum install gcc yum install pcre-devel yum install zlib zlib-devel yum install openssl openssl- ...

  2. LNMP1.3一键安装Linux环境,配置Nginx运行ThinkPHP3.2

    LNMP1.3一键安装Linux环境,配置Nginx运行ThinkPHP3.2 你是否遇见过:安装LNMP1.3环境后,运行ThinkPHP 3.2,只能打开首页,不能访问控制器,报404错误. 按照 ...

  3. Linux下安装php环境并且配置Nginx支持php-fpm模块[www]

    Linux下安装php环境并且配置Nginx支持php-fpm模块 http://www.cnblogs.com/freeweb/p/5425554.html 5分钟搭建 nginx +php --- ...

  4. ELK 6安装配置 nginx日志收集 kabana汉化

    #ELK 6安装配置 nginx日志收集 kabana汉化 #环境 centos 7.4 ,ELK 6 ,单节点 #服务端 Logstash 收集,过滤 Elasticsearch 存储,索引日志 K ...

  5. (转)windows 下安装配置 Nginx 详解

    windows 下安装配置 Nginx 详解 本文转自https://blog.csdn.net/kingscoming/article/details/79042874 nginx功能之一可以启动一 ...

  6. Linux下xampp集成环境安装配置方法 、部署bugfree及部署禅道

    XAMPP(Apache+MySQL+PHP+PERL)是一个功能强大的建站集成软件包.XAMPP 是一个易于安装且包含 MySQL.PHP 和 Perl 的 Apache 发行版.XAMPP 的确非 ...

  7. Sencha Toucha 2 —1.环境安装配置、在线打包、离线打包

    环境安装配置        1. 下载 1.1     Sencha Touch 下载 http://cdn.sencha.com/touch/sencha-touch-2.2.1-gpl.zip 1 ...

  8. [转载]SharePoint 2013测试环境安装配置指南

    软件版本 Windows Server 2012 标准版 SQL Server 2012 标准版 SharePoint Server 2013 企业版 Office Web Apps 2013 备注: ...

  9. Windows7 x64 跨平台开发环境安装配置

    ======================================================================= Windows7 x64 跨平台开发环境安装配置 201 ...

随机推荐

  1. 七天学会ASP.NET MVC

    地址一: http://www.cnblogs.com/powertoolsteam/p/MVC_one.html http://www.cnblogs.com/powertoolsteam/p/MV ...

  2. 004-log-common-logging,Apache整合日志框架JCL门面框架、JCL+log4j

    一.概述 Jakarta Commons Logging (JCL)提供的是一个日志(Log)接口(interface),同时兼顾轻量级和不依赖于具体的日志实现工具.它提供给中间件/日志工具开发者一个 ...

  3. c++拷贝文件-传统处理异常(学习)

    #include <iostream>#include <stdio.h> using namespace std; int my_copy(const char* src_f ...

  4. Docker 实践备忘录

    平时零散的接触docker,时间久了概念和命令都会忘了,所以集中记下: docker 目标是实现轻量级的操作系统虚拟化解决方案. Docker 的基础是 Linux 容器(LXC)等技术 docker ...

  5. css解决fixed布局不会出现滚动条的问题

  6. InfluxDB入门教程

    前言InfluxDB是一个时序性数据库,详细资料如下http://liubin.org/blog/2016/02/18/tsdb-intro/ 下载和安装LZ从官网下载的是influxdb-1.2.4 ...

  7. python基础----pymysql模块

    安装pymysql   ----pip install mysql 步骤: 1.建立连接   指定ip.端口号.密码.账号.数据库 2.建立游标 3.执行sql语句 4.获取结果或提交 5.关闭游标, ...

  8. 关于C++的智能指针

    一句话概括:当类中有指针成员时,可以使用智能指针实现对象共享:智能指针通过引用计数实现,即对指向同一对象的指针计数:智能指针的使用可以方便/安全地控制对象的生命周期,对指针进行自动销毁. 当类中有指针 ...

  9. 通用 spring cloud 微服务模板

    说明文档 功能 1. 基于映射数据库一键生成 spring cloud 微服务 2. 通用 Controller ,无需编写代码即可完成基于数据库的服务 3. 动态多条件 CRUD + 分页 使用说明 ...

  10. 菜鸟系列Fabric源码学习—创建通道

    通道创建源码解析 1. 与通道创建相关配置及操作命令 主要是configtx.yaml.通过应用通道的profile生成创建通道的配置文件. TwoOrgsChannel: Consortium: S ...