zoukankan      html  css  js  c++  java
  • 一些Nginx的Linux命令和conf配置文件

    lsof -i :80       查看80端口状态

    netstat -tunlp   查看所有端口状态 可以跟上 | grep xxxx  例如 

    netstat -tunlp | grep nginx

    检查nginx配置文件命令  ../sbin/nginx -g ../conf/nginx.conf

    只更新nginx配置文件   killall -s HUP nginx

    kill -HUP pid 或者 killall -HUP pName
    其中pid是进程标识,pName是进程的名称
    如果想要更改配置而不需停止并重新启动服务,可以使用上面两个命令。在对配置文件作必要的更改后,发出该命令以动态更新服务配置。
    根据约定,当你发送一个挂起信号(信号1或HUP)时,大多数服务器进程(所有常用的进程)都会进行复位操作并重新加载它们的配置文件。

    sed -i "/#/d" nginx.conf       删除nginx.conf中带#的行
    sed -i "/^$/d" nginx.conf     删除nginx.conf中空行

    一台服务器下配置了多个Tomcat之后,负载均衡

    worker_processes  1;
    events {
        worker_connections  1024;
    }
    http {
        include       mime.types;
        default_type  application/octet-stream;
        sendfile        on;
        keepalive_timeout  65;
        upstream myserver{
            ip_hash; #处理了tomcat之间session的问题,分发到固定ip
            server 119.3.215.xx:8080 weight=1;
            server 119.3.215.xx:8081 weight=1;
         server 119.3.215.xx:8082 backup;#宕机时候备用的 } server { listen
    80; server_name 119.3.215.21; location / { root html/web1; index index.html index.htm; proxy_pass http://myserver; proxy_connect_timeout 10; #表示超时10s即转发到其他服务器请求,也可以应对某台服务器宕机情况,不影响客户体验。 } error_page 500 502 503 504 /50x.html; location = /50x.html { root html; } } }
  • 相关阅读:
    codeforces C. Cows and Sequence 解题报告
    codeforces A. Point on Spiral 解题报告
    codeforces C. New Year Ratings Change 解题报告
    codeforces A. Fox and Box Accumulation 解题报告
    codeforces B. Multitasking 解题报告
    git命令使用
    shell简单使用
    知识束缚
    php 调用系统命令
    数据传输方式(前端与后台 ,后台与后台)
  • 原文地址:https://www.cnblogs.com/Esquecer/p/12286515.html
Copyright © 2011-2022 走看看