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 测试

  • 相关阅读:
    手工杀毒笔记
    中国黑客名单
    SQL Server 2005 数据库知识大全
    sql server和oracle行转列的一种典型方法
    <h1><span>标签在SEO中的作用及用法
    传说能加快vs编译速度(vs2008+cf3.5)
    WPF版调色器
    SQL经典案例
    Silverlight 2 相关文章汇总
    国内一些黑客高手的联系方式
  • 原文地址:https://www.cnblogs.com/han1094/p/6378022.html
Copyright © 2011-2022 走看看