zoukankan      html  css  js  c++  java
  • Linux 之 LNMP服务器搭建-Nginx

     LNMP服务器搭建-Nginx


     参考教程:【千峰教育


    系统版本:

      CentOS 6.8


    关闭防火墙和Selinux

    service iptables stop
    setenforce 0

    安装Nginx

    (1)创建nginx运行账户www,不允许直接登录系统

    useradd www -s /sbin/nologin

    (2)解压源码包

    cd /lnmp/src/
    tar -zxvf nginx-1.14.2.tar.gz
    cd nginx-1.14.2

    (3)配置

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

    (4)编译安装

    make && make install

    (5)查看、测试:

    方式一:检查配置文件nginx.conf的正确性命令
    /usr/local/nginx/sbin/nginx -t
    方式二:检查nginx版本
    /usr/local/nginx/sbin/nginx -v
    方式三:启动nginx,在浏览器中看是否有Welcome to nginx!
    /usr/local/nginx/sbin/nginx

    (6)设置nginx开机启动
    cp nginx /etc/rc.d/init.d/ #拷贝启动文件
    (注意,这里没有找到这个nginx文件,我是从网上找了一个,请参考我的另一篇博客)
    chmod 775 /etc/rc.d/init.d/nginx #赋予文件执行权限
    chkconfig nginx on #设置开启启动

    (7)nginx启动、停止、重启
    service nginx start|stop|restart

    (8)nginx默认访问的web目录

    /usr/local/nginx/html


  • 相关阅读:
    LeetCode Single Number
    Leetcode Populating Next Right Pointers in Each Node
    LeetCode Permutations
    Leetcode Sum Root to Leaf Numbers
    LeetCode Candy
    LeetCode Sort List
    LeetCode Remove Duplicates from Sorted List II
    LeetCode Remove Duplicates from Sorted List
    spring MVC HandlerInterceptorAdapter
    yum
  • 原文地址:https://www.cnblogs.com/gyfluck/p/10454932.html
Copyright © 2011-2022 走看看