zoukankan      html  css  js  c++  java
  • Nginx相关

    (内容有摘抄,如侵权,联系删除,谢谢)

    1、安装nginx

    2、启动:

    #启动nginx
    $/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    #查看nginx的运行情况
    $ps -ef | grep nginx
    $netstat -tunlp | grep 8000
    -t (tcp) 仅显示tcp相关选项
    -u (udp)仅显示udp相关选项
    -n 拒绝显示别名,能显示数字的全部转化为数字
    -l 仅列出在Listen(监听)的服务状态
    -p 显示建立相关链接的程序名

    3、停止操作

    #查询nginx主进程号
    $ps -ef | grep nginx
    #从容停止Nginx:
    $kill -QUIT 主进程号  
    #例如:kill -QUIT 16391
    
    #快速停止Nginx:
    $kill -TERM 主进程号  
    
    #强制停止Nginx:
    $kill -9 主进程号  
    #kill -HUP 住进称号或进程号文件路径  或者使用
    $/usr/nginx/sbin/nginx -s reload  
    
    nginx -t -c /usr/nginx/conf/nginx.conf 
    或者
    /usr/nginx/sbin/nginx -t 

    4、conf/nignx.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{
            listen    80;
            server_name (域名);
            index index.html index.htm index.shtml;
            location / {
                proxy_pass http://(下面upstream对应名称);
                proxy_set_header X-real-ip $remote_addr;
                proxy_set_header Host $http_host;
            }
            #access_log  /data/wwwlogs/access_op.report.bitauto.com.log  access;
        }
    
        upstream 名称{
            server (ip):8101;
        }
    }
  • 相关阅读:
    搭建ARL资产安全灯塔
    免杀技术发展史
    米酷CMS 7.0.4代码审计
    腾讯安全实习 应用运维安全面试
    Docker部署CTF综合性靶场,定时刷新环境
    西湖论剑2020MISC-Yusa_yyds
    (转)马云炮轰银行监管的解读
    ATT&CK 实战
    Docker环境复现利用Redis未授权访问漏洞 >> 批量扫描检测利用
    修改CH340芯片信息
  • 原文地址:https://www.cnblogs.com/wu-fm/p/9084831.html
Copyright © 2011-2022 走看看