zoukankan      html  css  js  c++  java
  • lemp-----1安装nginx

    yum install pcre-devel openssl-devel    #安装环境

    groupadd www && useradd -s /sbin/nologin -g www -M www   #建立属于nginx的用户和组

    wget http://nginx.org/download/nginx-1.10.3.tar.gz    #下载nginx

    tar zvxf nginx-1.10.3.tar.gz     #解压

    安装

    ./configure --user=www --group=www --prefix=/usr/local/nginx --with-http_ssl_module --with-http_realip_module --with-http_stub_status_module

    make

    make install

    写system文件方便管理

    vi /usr/lib/systemd/system/nginx.service

      

    [Unit]
    Description=nginx - high performance web server
    Documentation=http://nginx.org/en/docs
    After=network.target remote-fs.target nss-lookup.target

    [Service]
    Type=forking
    PIDFile=/usr/local/nginx/logs/nginx.pid
    ExecStartPre=/usr/local/nginx/sbin/nginx -t -c /usr/local/nginx/conf/nginx.conf
    ExecStart=/usr/local/nginx/sbin/nginx -c /usr/local/nginx/conf/nginx.conf
    ExecReload=/bin/kill -s HUP $MAINPID
    ExecStop=/bin/kill -s QUIT $MAINPID
    PrivateTmp=true

    [Install]
    WantedBy=multi-user.target

    systemctl daemon-reload   #重新加载

    systemctl restart nginx.service #重启

    lsof -i:80

    systemctl enable nginx.service
    lsof -i:80

    ln -s /usr/local/nginx/conf/nginx.conf /etc/nginx/nginx.conf

    vi /etc/nginx/nginx.conf

    echo "<h1>hanleizuishuai</h1>" > /web/index.html

    chcon -R -t httpd_sys_rw_content_t /web/

    systemctl restart nginx.service

    systemctl stop firewalld.service
     systemctl disable firewalld.service

    访问192.168.1.142 测试

  • 相关阅读:
    从书上学的东西(顺带总结一发)
    网上讲的好的知识点汇总
    土地征用题解(兼斜率优化详解)
    Blocks题解(区间dp)
    高精度模板汇总
    动态规划总结
    异或序列(题解)(莫队)
    小Z的袜子(题解)(莫队)
    小B的询问(题解)(莫队)
    凸包模板——Graham扫描法
  • 原文地址:https://www.cnblogs.com/han1094/p/6378022.html
Copyright © 2011-2022 走看看