Nginx com opções de configuração -cc-opt e with-ld-opt

1

Quando executo nginx -V , obtenho algo assim na saída.

--with-ld-opt='-lrt -ljemalloc -Wl,-z,relro' --with-cc-opt='-m64 -mtune=native -g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wno-sign-compare -Wno-string-plus-int -Wno-deprecated-declarations -Wno-unused-parameter -Wno-unused-const-variable -Wno-conditional-uninitialized -Wno-mismatched-tags -Wno-c++11-extensions -Wno-sometimes-uninitialized -Wno-parentheses-equality -Wno-tautological-compare -Wno-self-assign -Wno-deprecated-register -Wno-deprecated -Wno-invalid-source-encoding -Wno-pointer-sign -Wno-parentheses -Wno-enum-conversion'

O que é isto e como saber quais valores precisam ir aqui quando compilar o nginx do código-fonte?

    
por user3448600 22.08.2017 / 01:37

3 respostas

3

Fora da caixa, você provavelmente não precisa fornecer nenhum sinalizador, o script de configuração deve detectar automaticamente alguns padrões razoáveis.

No entanto, para otimizar a velocidade e / ou a segurança, você provavelmente deve fornecer alguns sinalizadores de compilador. A Red Hat publicou um artigo sobre as coleções de bandeiras que eles consideram Boa. Os sinalizadores que começam com -Wl são usados pelo vinculador, portanto, você deve fornecê-los usando --with-ld-opt . Por exemplo. -Wl,-pie se tornaria --with-ld-opt="-pie" .

Outra maneira razoável de fazer isso seria copiar as opções usadas pelos pacotes fornecidos pela distribuição. O mantenedor provavelmente sabe o que estava fazendo e, pelo menos, você sabe que funciona para o seu caso de uso.

    
por 27.03.2018 / 13:03
1

Esta opção Nginx mostra opções de configuração (necessárias para configurar seu compilador e linker):

-V            : show version and configure options then exit

Como esta página de documentação diz - > link :

--with-ld-opt=parameters — sets additional parameters that will be used during linking. 
--with-cc-opt=parameters — sets additional parameters that will be added to the CFLAGS variable. 

Então, os primeiros são o que você deseja adicionar a um linker (ld), o segundo é destinado a um compilador (cc, gcc, etc.). Para obter mais informações sobre essas opções, consulte a página do manual do gcc: link

    
por 27.03.2018 / 10:25
0

Quando você insere o seguinte comando:
nginx -V -h
onde:
-V: : show version and configure options then exit
Então você pode configurar sua construção de acordo com vários parâmetros.  A construção pode ser configurada usando o comando configure.

--sbin-path=path — sets the name of an nginx executable file. This name is used only during installation. By default the file is named prefix/sbin/nginx.

--conf-path=path — sets the name of an nginx.conf configuration file. If needs be, nginx can always be started with a different configuration file, by specifying it in the command-line parameter -c file. By default the file is named prefix/conf/nginx.conf.

--pid-path=path — sets the name of an nginx.pid file that will store the process ID of the main process. After installation, the file name can always be changed in the nginx.conf configuration file using the pid directive. By default the file is named prefix/logs/nginx.pid.

--error-log-path=path — sets the name of the primary error, warnings, and diagnostic file. After installation, the file name can always be changed in the nginx.conf configuration file using the error_log directive. By default the file is named prefix/logs/error.log.

--http-log-path=path — sets the name of the primary request log file of the HTTP server. After installation, the file name can always be changed in the nginx.conf configuration file using the access_log directive. By default the file is named prefix/logs/access.log.

--build=name — sets an optional nginx build name.

--user=name — sets the name of an unprivileged user whose credentials will be used by worker processes. After installation, the name can always be changed in the nginx.conf configuration file using the user directive. The default user name is nobody.

--group=name — sets the name of a group whose credentials will be used by worker processes. After installation, the name can always be changed in the nginx.conf configuration file using the user directive. By default, a group name is set to the name of an unprivileged user.

--with-select_module
--without-select_module — enables or disables building a module that allows the server to work with the select() method. This module is built automatically if the platform does not appear to support more appropriate methods such as kqueue, epoll, or /dev/poll.

--with-poll_module
--without-poll_module — enables or disables building a module that allows the server to work with the poll() method. This module is built automatically if the platform does not appear to support more appropriate methods such as kqueue, epoll, or /dev/poll.

--without-http_gzip_module — disables building a module that compresses responses of an HTTP server. The zlib library is required to build and run this module.

--without-http_rewrite_module — disables building a module that allows an HTTP server to redirect requests and change URI of requests. The PCRE library is required to build and run this module.

--without-http_proxy_module — disables building an HTTP server proxying module.

--with-http_ssl_module — enables building a module that adds the HTTPS protocol support to an HTTP server. This module is not built by default. The OpenSSL library is required to build and run this module.

--with-pcre=path — sets the path to the sources of the PCRE library. The library distribution (version 4.4 — 8.41) needs to be downloaded from the PCRE site and extracted. The rest is done by nginx’s ./configure and make. The library is required for regular expressions support in the location directive and for the ngx_http_rewrite_module module.

--with-pcre-jit — builds the PCRE library with “just-in-time compilation” support (1.1.12, the pcre_jit directive).

--with-zlib=path — sets the path to the sources of the zlib library. The library distribution (version 1.1.3 — 1.2.11) needs to be downloaded from the zlib site and extracted. The rest is done by nginx’s ./configure and make. The library is required for the ngx_http_gzip_module module.

--with-cc-opt=parameters — sets additional parameters that will be added to the CFLAGS variable. When using the system PCRE library under FreeBSD, --with-cc-opt="-I /usr/local/include" should be specified. If the number of files supported by select() needs to be increased it can also be specified here such as this: --with-cc-opt="-D FD_SETSIZE=2048".

--with-ld-opt=parameters — sets additional parameters that will be used during linking. When using the system PCRE library under FreeBSD, --with-ld-opt="-L /usr/local/lib" should be specified.'


Configure de acordo com sua necessidade e, onde quer que você esteja, basta adicionar -h para obter as informações sobre um determinado argumento em sua configuração.

    
por 31.03.2018 / 16:28

Tags