AskOverflow.Dev

AskOverflow.Dev Logo AskOverflow.Dev Logo

AskOverflow.Dev Navigation

  • 主页
  • 系统&网络
  • Ubuntu
  • Unix
  • DBA
  • Computer
  • Coding
  • LangChain

Mobile menu

Close
  • 主页
  • 系统&网络
    • 最新
    • 热门
    • 标签
  • Ubuntu
    • 最新
    • 热门
    • 标签
  • Unix
    • 最新
    • 标签
  • DBA
    • 最新
    • 标签
  • Computer
    • 最新
    • 标签
  • Coding
    • 最新
    • 标签
主页 / server / 问题 / 869794
Accepted
user3448600
user3448600
Asked: 2017-08-22 15:37:38 +0800 CST2017-08-22 15:37:38 +0800 CST 2017-08-22 15:37:38 +0800 CST

Nginx with-cc-opt 和 with-ld-opt 配置选项

  • 772

当我运行时,nginx -V我会在输出中得到类似的东西。

--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'

这是什么以及如何知道从源代码编译 nginx 时需要去这里的哪些值?

nginx
  • 3 3 个回答
  • 7788 Views

3 个回答

  • Voted
  1. Best Answer
    Antoine Albertelli
    2018-03-28T03:03:47+08:002018-03-28T03:03:47+08:00

    开箱即用您可能不需要自己提供任何标志,配置脚本应该自动检测一些合理的默认值。

    但是,为了优化速度和/或安全性,您可能应该提供一些编译器标志。Red Hat 发表了一篇关于他们认为不错的标志集合的文章。以 开头的标志-Wl由链接器使用,因此您应该使用--with-ld-opt. 例如-Wl,-pie会变成--with-ld-opt="-pie".

    另一种合理的方法是复制您的发行版提供的软件包使用的选项。维护者可能知道他在做什么,并且您至少知道它适用于您的用例。

    • 9
  2. patok
    2018-03-28T00:25:13+08:002018-03-28T00:25:13+08:00

    此 Nginx 选项显示配置选项(需要设置编译器和链接器):

    -V            : show version and configure options then exit
    

    正如本文档页面所说-> http://nginx.org/en/docs/configure.html:

    --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. 
    

    因此,第一个是您要添加到链接器(ld)的内容,第二个是用于编译器(cc、gcc 等)的。有关这些选项的更多信息,请参阅 gcc 手册页:https ://linux.die.net/man/1/gcc

    • 1
  3. New Name
    2018-04-01T06:28:33+08:002018-04-01T06:28:33+08:00

    当您输入以下命令时:
    nginx -V -h
    where:
    -V: : show version and configure options then exit
    因此您可以使用各种参数相应地配置您的构建。可以使用 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.`
    


    根据您的需要进行配置,无论您遇到什么困难,只需添加-h以获取有关配置中特定参数的信息。

    • 0

相关问题

  • Gzip 与反向代理缓存

  • nginx 作为代理的行为

  • Nginx 学习资源 [关闭]

  • 提供 70,000 个静态文件 (jpg) 的最佳方式?

  • 在 Apache、LightTPD 和 Nginx Web 服务器上提供 PHP 5.x 应用程序的现状?

Sidebar

Stats

  • 问题 205573
  • 回答 270741
  • 最佳答案 135370
  • 用户 68524
  • 热门
  • 回答
  • Marko Smith

    新安装后 postgres 的默认超级用户用户名/密码是什么?

    • 5 个回答
  • Marko Smith

    SFTP 使用什么端口?

    • 6 个回答
  • Marko Smith

    命令行列出 Windows Active Directory 组中的用户?

    • 9 个回答
  • Marko Smith

    什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同?

    • 3 个回答
  • Marko Smith

    如何确定bash变量是否为空?

    • 15 个回答
  • Martin Hope
    Tom Feiner 如何按大小对 du -h 输出进行排序 2009-02-26 05:42:42 +0800 CST
  • Martin Hope
    Noah Goodrich 什么是 Pem 文件,它与其他 OpenSSL 生成的密钥文件格式有何不同? 2009-05-19 18:24:42 +0800 CST
  • Martin Hope
    Brent 如何确定bash变量是否为空? 2009-05-13 09:54:48 +0800 CST
  • Martin Hope
    cletus 您如何找到在 Windows 中打开文件的进程? 2009-05-01 16:47:16 +0800 CST

热门标签

linux nginx windows networking ubuntu domain-name-system amazon-web-services active-directory apache-2.4 ssh

Explore

  • 主页
  • 问题
    • 最新
    • 热门
  • 标签
  • 帮助

Footer

AskOverflow.Dev

关于我们

  • 关于我们
  • 联系我们

Legal Stuff

  • Privacy Policy

Language

  • Pt
  • Server
  • Unix

© 2023 AskOverflow.DEV All Rights Reserve