Nginx 学习 一(安装)

 

1、从官网现在nginx 

wget  https://nginx.org/download/nginx-1.16.1.tar.gz

解压,共有如下目录文件

2、让nginx 配置文件 vim 语法高亮

原先的

复制contrib 目录下文件到当前用户下的.vim 目录中

cp -r contrib/vim/* ~/.vim/

复制完成之后,语法高亮

3、查看nginx 帮助文件

进入到man 录下下,可以看到有一个nginx.8 文件

man  ./nginx.8 
NGINX(8)                                             BSD System Manager's Manual                                             NGINX(8)

NAME
     nginx ?.HTTP and reverse proxy server, mail proxy server

SYNOPSIS
     nginx [-?hqTtVv] [-c file] [-g directives] [-p prefix] [-s signal]

DESCRIPTION
     nginx (pronounced ?.ngine x?. is an HTTP and reverse proxy server, as well as a mail proxy server.  It is known for its high
     performance, stability, rich feature set, simple configuration, and low resource consumption.

     The options are as follows:

     -?, -h         Print help.

     -c file        Use an alternative configuration file.

     -g directives  Set global configuration directives.  See EXAMPLES for details.

     -p prefix      Set the prefix path.  The default value is %%PREFIX%%.

     -q             Suppress non-error messages during configuration testing.

     -s signal      Send a signal to the master process.  The argument signal can be one of: stop, quit, reopen, reload.  The follow?
                    ing table shows the corresponding system signals:

                    stop    SIGTERM
                    quit    SIGQUIT
                    reopen  SIGUSR1
                    reload  SIGHUP

     -t             Do not run, just test the configuration file.  nginx checks the configuration file syntax and then tries to open
                    files referenced in the configuration file.

     -T             Same as -t, but additionally dump configuration files to standard output.

     -V             Print the nginx version, compiler version, and configure script parameters.

     -v             Print the nginx version.

SIGNALS
     The master process of nginx can handle the following signals:

     SIGINT, SIGTERM  Shut down quickly.
     SIGHUP           Reload configuration, start the new worker process with a new configuration, and gracefully shut down old
                      worker processes.
     SIGQUIT          Shut down gracefully.
     SIGUSR1          Reopen log files.
     SIGUSR2          Upgrade the nginx executable on the fly.
     SIGWINCH         Shut down worker processes gracefully.

     While there is no need to explicitly control worker processes normally, they support some signals too:

     SIGTERM          Shut down quickly.
     SIGQUIT          Shut down gracefully.
     SIGUSR1          Reopen log files.

DEBUGGING LOG
     To enable a debugging log, reconfigure nginx to build with debugging:

           ./configure --with-debug ...

     and then set the debug level of the error_log:

           error_log /path/to/log debug;

     It is also possible to enable the debugging for a particular IP address:

           events {
                   debug_connection 127.0.0.1;
           }

ENVIRONMENT
     The NGINX environment variable is used internally by nginx and should not be set directly by the user.

FILES
     %%PID_PATH%%
             Contains the process ID of nginx.  The contents of this file are not sensitive, so it can be world-readable.

     %%CONF_PATH%%
             The main configuration file.

     %%ERROR_LOG_PATH%%
             Error log file.

EXIT STATUS
     Exit status is 0 on success, or 1 if the command fails.

EXAMPLES
     Test configuration file ~/mynginx.conf with global directives for PID and quantity of worker processes:

           nginx -t -c ~/mynginx.conf \
                   -g "pid /var/run/mynginx.pid; worker_processes 2;"

SEE ALSO
     Documentation at http://nginx.org/en/docs/.

     For questions and technical support, please refer to http://nginx.org/en/support.html.

HISTORY
     Development of nginx started in 2002, with the first public release on October 4, 2004.

AUTHORS
     Igor Sysoev <[email protected]>.

     This manual page was originally written by Sergey A. Osokin <[email protected]> as a result of compiling many nginx documents
     from all over the world.

BSD 

4、编译nginx 

    执行配置,决定nginx 运行时的一些目录

./configure --prefix=/home/study/nginx

.......Configuration summary
  + using system PCRE library
  + OpenSSL library is not used
  + using system zlib library

  nginx path prefix: "/home/study/nginx"
  nginx binary file: "/home/study/nginx/sbin/nginx"
  nginx modules path: "/home/study/nginx/modules"
  nginx configuration prefix: "/home/study/nginx/conf"
  nginx configuration file: "/home/study/nginx/conf/nginx.conf"
  nginx pid file: "/home/study/nginx/logs/nginx.pid"
  nginx error log file: "/home/study/nginx/logs/error.log"
  nginx http access log file: "/home/study/nginx/logs/access.log"
  nginx http client request body temporary files: "client_body_temp"
  nginx http proxy temporary files: "proxy_temp"
  nginx http fastcgi temporary files: "fastcgi_temp"
  nginx http uwsgi temporary files: "uwsgi_temp"
  nginx http scgi temporary files: "scgi_temp"

 配置完成之后,会多一个objs 文件夹

在nginx 根目录下执行make编译

[root@zk02 nginx-1.16.1]# pwd
/soft/nginx-1.16.1
[root@zk02 nginx-1.16.1]# make

编译完成之后,会在objs 目录生成nginx 可执行二进制文件.

执行make  install 

执行完成之后,在prefix 指定的目录下,会生成如下文件

[study@zk02 nginx]$ pwd
/home/study/nginx
[study@zk02 nginx]$ ls 
conf  html  logs  sbin

进入sbin 目录,可以看到可执行的二进制文件

[study@zk02 nginx]$  cd sbin/
[study@zk02 sbin]$ ll
total 7472
-rwxr-xr-x 1 root root 3825176 Jan  4 19:02 nginx
-rwxr-xr-x 1 root root 3825176 Jan  4 19:00 nginx.old

至此,编译完成.

发布了192 篇原创文章 · 获赞 254 · 访问量 76万+

猜你喜欢

转载自blog.csdn.net/yulei_qq/article/details/103830344