zoukankan      html  css  js  c++  java
  • md测试

    1、编译安装LNMP,配置自定义404页面,配置访问日志为json格式。

    准备编译安装的基础环境
    [root@nginx ~]#  yum install -y vim lrzsz tree screen psmisc lsof tcpdump wget ntpdate gcc gcc-c++ glibc glibc-devel pcre pcre-devel openssl openssl-devel systemd-devel net-tools iotop bc zip unzip zlib-devel bash-completion nfs-utils automake libxml2 libxml2-devel libxslt libxslt-devel perl perl-ExtUtils-Embed
    
    准备nginx源码包
    [root@nginx ~]#  cd /usr/local/src
    [root@nginx src]#  wget https://nginx.org/download/nginx-1.17.10.tar.gz
    [root@nginx src]#  tar xf nginx-1.17.10.tar.gz
    [root@nginx src]#  cd nginx-1.17.10
    [root@nginx nginx-1.17.10]# 
    
    nginx编译 & 安装
    [root@nginx nginx-1.17.10]#  ./configure --prefix=/apps/nginx 
    --user=nginx 
    --group=nginx 
    --with-http_ssl_module 
    --with-http_v2_module 
    --with-http_realip_module 
    --with-http_stub_status_module 
    --with-http_gzip_static_module 
    --with-pcre 
    --with-stream 
    --with-stream_ssl_module 
    --with-stream_realip_module
    [root@nginx nginx-1.17.10]#  make && make install
    
    为nginx程序指定一个普通用户nginx
    [root@nginx nginx-1.17.10]#  useradd nginx -s /sbin/nologin -u 2000
    [root@nginx nginx-1.17.10]#  chown nginx.nginx -R /apps/nginx
    
    
    将nginx配置成一个服务
    [root@nginx nginx-1.17.10]#  echo '[Unit]
    Description=The nginx HTTP and reverse proxy server
    After=network.target remote-fs.target nss-lookup.target
    [Service]
    Type=forking
    PIDFile=/apps/nginx/logs/nginx.pid
    # Nginx will fail to start if /run/nginx.pid already exists but has the wrong
    # SELinux context. This might happen when running `nginx -t` from the cmdline.
    # https://bugzilla.redhat.com/show_bug.cgi?id=1268621
    ExecStartPre=/usr/bin/rm -f /apps/nginx/logs/nginx.pid
    ExecStartPre=/apps/nginx/sbin/nginx -t
    ExecStart=/apps/nginx/sbin/nginx
    ExecReload=/bin/kill -s HUP $MAINPID
    #KillSignal=SIGQUIT
    #TimeoutStopSec=5
    KillMode=process
    PrivateTmp=true
    [Install]
    WantedBy=multi-user.target ' > /usr/lib/systemd/system/nginx.service
    
    [root@nginx nginx-1.17.10]#  systemctl daemon-reload
    
    [root@nginx nginx-1.17.10]#  systemctl start nginx
    
    [root@nginx nginx-1.17.10]#  systemctl enable nginx
    
    [root@nginx nginx-1.17.10]#  systemctl status nginx
    
    [root@nginx nginx-1.17.10]#  curl http://127.0.0.1
    <!DOCTYPE html>
    <html>
    <head>
    <title>Welcome to nginx!</title>
    <style>
        body {
             35em;
            margin: 0 auto;
            font-family: Tahoma, Verdana, Arial, sans-serif;
        }
    </style>
    </head>
    <body>
    <h1>Welcome to nginx!</h1>
    <p>If you see this page, the nginx web server is successfully installed and
    working. Further configuration is required.</p>
    
    <p>For online documentation and support please refer to
    <a href="http://nginx.org/">nginx.org</a>.<br/>
    Commercial support is available at
    <a href="http://nginx.com/">nginx.com</a>.</p>
    
    <p><em>Thank you for using nginx.</em></p>
    </body>
    </html>
    
    1.3 配置404错误页面
    1.4 配置日志格式为json
    1.5 验证
  • 相关阅读:
    TFTP服务器的使用
    SecureCRT Ver 8.1.4 整合汉化绿色版一体包
    SecureCRT Ver 8.1.4 整合汉化绿色版一体包
    深度好贴,mark一下!
    DataSnap——利用TParams进行多表事务更新
    临时表经典使用范例
    PHP对文件的操作方法
    中国银行支付接口(ecshop版)
    常用支付接口实例php版
    PHPCMS网站二次开发配置要点
  • 原文地址:https://www.cnblogs.com/www1707/p/12674896.html
Copyright © 2011-2022 走看看