zoukankan      html  css  js  c++  java
  • 安装Nginx

      Linux下安装Nginx,需要保证一些依赖的库先被安装好。

    1、安装好g++、ssl、pcre、zlib库文件

    2、安装Nginx

      1)执行./configure 命令编译,需指定一些编译参数

      --prefix=  定义安装目录(默认/usr/local/nginx)

      --sbin-path=  定义nginx可以执行文件路径(默认prefix/sbin/nginx)

      --conf-path=  定义nginx配置文件目录(默认prefix/conf/nginx.conf)

      --pid-path=  定义nginx.pid文件路径(默认prefix/logs/nginx.pid)

      --with-pcre=  定义pcre库文件路径(rewrite需要用到)

      --with-zlib=  定义zlib库文件路径(gzip压缩用到)

    ./configure --with-http_ssl_module 
                --with-pcre=/usr/local/pcre-8.36  
                --with-zlib=/usr/local/zlib-1.2.8

      不指定的参数就使用默认值。

      2)安装命令 make & make install

    3、执行启动命令

    /usr/local/nginx/sbin/nginx

    4、看看进程id和端口

    [root@Luxh-01 logs]# ls
    access.log  error.log  nginx.pid
    [root@Luxh-01 logs]# cat nginx.pid 
    16275
    [root@Luxh-01 logs]# ls
    access.log  error.log  nginx.pid
    [root@Luxh-01 logs]# cat nginx.pid
    16275
    [root@Luxh-01 logs]# ps -ef|grep nginx
    root     16275     1  0 19:17 ?        00:00:00 nginx: master process ./nginx
    nobody   16276 16275  0 19:17 ?        00:00:00 nginx: worker process
    root     19463  5258  0 21:08 pts/0    00:00:00 grep nginx
    [root@Luxh-01 logs]# 
    [root@Luxh-01 logs]# netstat -ano|grep 80
    tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      off (0.00/0/0)
    udp        0      0 :::58067                    :::*                                    off (0.00/0/0)
    unix  2      [ ]         DGRAM                    18807  
    unix  2      [ ]         DGRAM                    12803  
    [root@Luxh-01 logs]#

    5、默认的日志文件目录

    [root@Luxh-01 logs]# pwd
    /usr/local/nginx/logs
    [root@Luxh-01 logs]# ls
    access.log  error.log  nginx.pid

    6、nginx编译选项可参考

    http://nginx.org/en/docs/configure.html

  • 相关阅读:
    javascript取最小值方法 apply
    c# 通过字符串获取与字符串同名的变量的值
    访问者地图 地址收藏
    自定义Dialog(一)
    android应用多主题
    maven setting 文件
    手动安装cloudera cdh4.2 hadoop + hbase + hive(三)
    手动安装cloudera cdh4.2 hadoop + hbase + hive(一)
    使用Hive读取Hbase中的数据
    手机共享电脑网络
  • 原文地址:https://www.cnblogs.com/luxh/p/4067038.html
Copyright © 2011-2022 走看看