nginx命令

验证配置是否正确: nginx -t
查看Nginx的版本号:nginx -V
启动Nginx:start nginx
快速停止或关闭Nginx:nginx -s stop
正常停止或关闭Nginx:nginx -s quit
配置文件修改重装载命令:nginx -s reload

实际使用
sbin文件夹同目录下:执行相应命令
启动Nginx:进入sbin文件夹再执行命令 ./nginx
快速停止或关闭Nginx:sbin/nginx -s stop
正常停止或关闭Nginx:sbin/nginx -s quit
配置文件修改重装载命令:sbin/nginx -s reload

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       82;server_name  localhost;root D:/cardLoan/tuandai-loans/loans-web-admin/src/main/resources/web;#charset koi8-r;#access_log  logs/host.access.log  main;location / {root D:/cardLoan/tuandai-loans/loans-web-admin/src/main/resources/web;index  index.html index.htm;}#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 {#    alias   E:/aaa2#}# 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;#    }#}server {listen       80;server_name  dq.aaa.cn;#charset koi8-r;#access_log  logs/host.access.log  main;location / {proxy_pass    http://10.100.66.255:9007;proxy_redirect default ;              } }#server {#listen       80;#server_name  www.aaa.cn;#charset koi8-r;#access_log  logs/host.access.log  main;#location / {#proxy_pass    http://127.0.0.1:8081;#proxy_redirect default ;              #}#}server {listen       80;server_name  psjs.aaa.cn;#charset koi8-r;#access_log  logs/host.access.log  main;location /dq {alias   E:/psjs.aaa.cn-static/dq;#root   E:/td-sail-js;index  index.html index.htm;         } location /scripts {alias   E:/psjs.aaa.cn-static/dq/scripts;}location /images {alias   E:/psjs.aaa.cn-static/dq/images;#root   E:/td-sail-js;index  index.html index.htm;         } }server {listen       80;server_name  js2.aaa.cn;#root E:/aaa2/js.aaa.cn;#charset koi8-r;#access_log  logs/host.access.log  main;location / {root   E:/psjs.aaa.cn-static;index  index.html index.htm;}location /images {alias   E:/psjs.aaa.cn-static/images;index  index.html index.htm;}#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 {#    alias   E:/aaa2#}# 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;#}}
}

MP的配置方式
nginx.conf

# 常用命令
# 启动: nginx
# 重启: nginx -s reload
# 关闭: nginx -s stop# 1 域名+端口 唯一确定一个资源。 nginx 可以同时监听 多个虚拟域名 和 多个端口。可以做方向代理# 用的帐号和组,windows的直接注释掉就好了
#user  benny staff;
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;gzip_min_length 1k;gzip_buffers 16 64k;gzip_http_version 1.1;gzip_comp_level 6;gzip_types text/plain application/x-javascript text/css application/xml application/javascript;gzip_vary on;# 当你访问localhost时的站点配置,地址默认是d:/wwwrootserver {listen       90;server_name  localhost;#charset koi8-r;#access_log  logs/host.access.log  main;#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;#}}# include vhosts/*.conf; # 将vhosts所有东西包含进来include vhosts/cardloan.dev.com.conf;autoindex on; #开启nginx目录浏览功能autoindex_exact_size off; #文件大小从KB开始显示autoindex_localtime on; #显示文件修改时间为服务器本地时间# 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;#    }#}}

vhost.conf

# 想建一个新站点?
# 1、复制本文件然后改名
# 2、修改root值,指向你的新站点根目录
# 3、运行nginx -s reload 重新加载配置就行了
server {listen  82;server_name  cardload.dev.com;root   D:/cardLoan/tuandai-loans/loans-web-admin/src/main/resources/web;index  index.html index.htm;error_page   500 502 503 504  /50x.html;location ~ /.ht {deny  all;}
}

网上找的 如card.dev.com.conf

http {include       mime.types;default_type  application/octet-stream;sendfile        on; keepalive_timeout  65; gzip  on;upstream localhost {server 127.0.0.1:8080 max_fails=7 fail_timeout=7s;}   server {listen       81; server_name  localhost;location / { root html;index index.html index.htm;proxy_pass http://localhost;}   }   server {listen       80; server_name  localhost;#charset koi8-r;#access_log  logs/host.access.log  main;location / { root   html;index  index.html index.htm;proxy_pass http://localhost;}}
}

nginx——虚拟域名与多端口监听及其配置以及nginx命令相关推荐

  1. 在linux中查看nginx端口监听,Nginx端口监听(listen指令)

    本节主要来介绍 Nginx 中与端口监听有关的配置指令,下表为端口监听指令及其相关说明. 名称 端口监听指令 指令 listen 作用域 server 默认值 listen*:80 或 *:8000 ...

  2. linux修改端口监听地址,修改nginx/Tomcat等Web服务的端口监听地址

    我们将一起来学习如何在Linux实例中修改nginx.Tomcat等常见Web服务的端口监听地址. 前提条件 你已经在Linux实例上安装了Web服务器.你可以参考以下文档安装并启动相应的服务: 你已 ...

  3. 解决服务器80端口监听异常导致无法打开和访问网站的问题

    转载:原文章地址:解决服务器80端口监听异常导致无法打开和访问网站的问题 - 爱码网 如果遇到IIS服务器的网站无法访问,并在IE/EDGE浏览器中显示无法显示此页的问题,一般情况下是有多种可能因素, ...

  4. Ejabberd源码学习——端口监听及报文转发流程

    这篇文章是我之前在RYTong内部分享的一篇文章.上一篇文章说到Ejabberd在启动的时候会监听配置的端口,但没有详细解释监听的流程.这篇我们就来看看Ejabberd监听端口的实现逻辑,了解下一个X ...

  5. C#版及nodejs版的com端口监听程序

    感受: 写监听程序的感受:原来有些事情并不是想象的那么难,难和简单就只在一个点上,一个点突破了,后面就豁然开朗了.所以有些问题,不能死闷,要先思考,然后查资料,然后问有经验的人. 最近写一个com端口 ...

  6. 获取运行端口监听的用户身份auth-owner

    获取运行端口监听的用户身份auth-owner Windows系统提供工作在TCP 113端口的授权服务(Authentication Service),用来判断TCP连接的用户.Nmap的auth- ...

  7. Linux查看端口监听情况,以及Linux查看某个端口对应的进程号和程序

    文章目录: 1 linux查看那端口监听情况 2 Linux查看某个端口对应的进程号和程序 1 linux查看那端口监听情况 linux中可以使用netstat命令查看端口监听情况,首先来看一下该命令 ...

  8. TCP 端口监听队列原理

    近期需要实现一个TCP线程池服务,该服务需要能够在同一个端口上实现 TCP 常规服务.HTTP请求服务.SOAP WebService 服务,为了测试 ACE 的线程池启动后,如果所有线程都在忙,客户 ...

  9. php 监听端口数据客户端ip_PHP做端口监听示例代码

    1,PHP端口监听之服务器端 复制代码 代码示例: // Server // 设置错误处理 error_reporting(E_ALL); // 设置运行时间 set_time_limit(0); / ...

最新文章

  1. 在IIS8.5的环境下配置WCF的Restful Service
  2. 关于java的一个典型的动态代理
  3. 网络营销——网络营销浅析网站不发文还能维持稳定排名吗?
  4. python把dict转为dataframe,将python OrderedDict转换为datafram
  5. android属性动画作用范围,Android开发之动画效果浅析(一)
  6. 帧大小超过交换机mtu_tcpip – UDP中的MTU如何为65535,但以太网不允许超过1500字节的帧大小...
  7. Scrapy-redis实现分布式爬取的过程与原理
  8. javamail “535 5.7.3 Authentication unsuccessful“ 问题排查
  9. @requestbody和@requestparam作用
  10. spss 卡方检验_SPSS篇—卡方检验
  11. requests中获取请求到文本编码格式
  12. 苹果最新专利曝光:苹果可能正研发可折叠iPhone
  13. 精简DropDownList用法
  14. UnityShader18:立方体贴图(上)
  15. zbb20180613 Spring MVC实现大文件下载功能
  16. Visio2010安装和卸载
  17. 如何使用jmeter录制脚本
  18. 【Unity3D】Photon环境搭建
  19. 微信公众号服务器架构,Flask框架实现微信公众号开发(接入微信服务器)
  20. GRE词汇竟然六小时背一遍

热门文章

  1. 寻找图像中的局部极大点
  2. mysql左对齐原则_MySQL 设计与开发规范
  3. 重庆阿尔克解读从1G到5G--手机网络技术发展史
  4. python抽卡游戏概率计算
  5. 树莓派入手先做的几件事情
  6. 王嘉尔成为Dr.Jart+蒂佳婷品牌亚太区面膜代言人
  7. 【GIT】GitHub中的readme.md说明文档中如何将表格居中显示?
  8. 扫地机器人石头爬坡_为什么要给朋友推荐石头扫地机器人?石头 T6扫地机器人测评体验...
  9. OSChina 周二乱弹 ——曝光巴叔最爱蕾丝女仆机器人
  10. Vue实现发送短息60秒倒计时