在centos7中make nginx时出错

在centos7中make nginx时出错

我在制作nginx时添加了一些其他模块。配置文件如下

./configure --prefix=/etc/nginx --sbin-path=/usr/sbin/nginx --modules-path=/usr/lib64/nginx/modules --conf-path=/etc/nginx/nginx.conf --error-log-path=/var/log/nginx/error.log --http-log-path=/var/log/nginx/access.log --pid-path=/var/run/nginx.pid --lock-path=/var/run/nginx.lock --http-client-body-temp-path=/var/cache/nginx/client_temp --http-proxy-temp-path=/var/cache/nginx/proxy_temp --http-fastcgi-temp-path=/var/cache/nginx/fastcgi_temp --http-uwsgi-temp-path=/var/cache/nginx/uwsgi_temp --http-scgi-temp-path=/var/cache/nginx/scgi_temp --user=nginx --group=nginx --with-compat --with-file-aio --with-threads --with-http_addition_module --with-http_auth_request_module --with-http_dav_module --with-http_flv_module --with-http_gunzip_module --with-http_gzip_static_module --with-http_mp4_module --with-http_random_index_module --with-http_realip_module --with-http_secure_link_module --with-http_slice_module --with-http_ssl_module --with-http_stub_status_module --with-http_sub_module --with-http_v2_module --with-mail --with-mail_ssl_module --with-stream --with-stream_realip_module --with-stream_ssl_module --with-stream_ssl_preread_module --with-cc-opt='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -fPIC' --with-ld-opt='-Wl,-z,relro -Wl,-z,now -pie' --with-pcre=../pcre-8.40 --with-zlib=../zlib-1.2.11 --with-openssl=../openssl-1.0.1g

但是当我 make&&make intall 时,发生错误,错误的某些部分是:

     can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(e_aep.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(e_atalla.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(e_cswift.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(e_chil.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(e_nuron.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(e_sureware.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(e_ubsec.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(gost_eng.o): relocation R_X86_64_32S against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(gost_md.o): relocation R_X86_64_32 against symbol `GostR3411_94_CryptoProParamSet' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(gost_pmeth.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(gost_sign.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(wp_dgst.o): relocation R_X86_64_32 against `.bss' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(xcbc_enc.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(aes_wrap.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(bf_skey.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(bf_ecb.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(bf_enc.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(c_skey.o): relocation R_X86_64_32S against symbol `CAST_S_table6' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(c_enc.o): relocation R_X86_64_32S against symbol `CAST_S_table3' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(bn_div.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(bn_kron.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(bn_sqrt.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(bn_exp2.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(bn_gf2m.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(ecp_mont.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(ec_print.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(rsa_saos.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(rsa_pss.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(dh_gen.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(dso_dlfcn.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(eng_cnf.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(evp_cnf.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(a_set.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(asn_moid.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(cms_lib.o): relocation R_X86_64_32 against symbol `CMS_ContentInfo_it' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(cms_io.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(cms_dd.o): relocation R_X86_64_32 against symbol `CMS_DigestedData_it' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(e_gost_err.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(gost2001_keyx.o): relocation R_X86_64_32 against symbol `GostR3411_94_CryptoProParamSet' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(gost2001.o): relocation R_X86_64_32 against symbol `R3410_2001_paramset' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(gost89.o): relocation R_X86_64_32 against symbol `GostR3411_94_TestParamSet' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(gost94_keyx.o): relocation R_X86_64_32 against symbol `GostR3411_94_CryptoProParamSet' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(gost_ameth.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(gost_asn1.o): relocation R_X86_64_32 against symbol `GOST_KEY_TRANSPORT_it' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(gost_crypt.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(gost_ctl.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(ecp_smpl.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(bio_ndef.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(asn_mime.o): relocation R_X86_64_32 against `.text' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(bio_b64.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../openssl-1.0.1g/.openssl/lib/libcrypto.a(bio_asn1.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../zlib-1.2.11/libz.a(crc32.o): relocation R_X86_64_32S against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../zlib-1.2.11/libz.a(deflate.o): relocation R_X86_64_32S against hidden symbol `_length_code' can not be used when making a shared object
/usr/bin/ld: ../zlib-1.2.11/libz.a(inflate.o): relocation R_X86_64_32S against hidden symbol `zcfree' can not be used when making a shared object
/usr/bin/ld: ../zlib-1.2.11/libz.a(inftrees.o): relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../zlib-1.2.11/libz.a(trees.o): relocation R_X86_64_32S against hidden symbol `_length_code' can not be used when making a shared object
/usr/bin/ld: ../zlib-1.2.11/libz.a(zutil.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: ../zlib-1.2.11/libz.a(inffast.o): relocation R_X86_64_32S against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
collect2: error: ld returned 1 exit status
make[1]: *** [objs/nginx] Error 1
make[1]: Leaving directory `/root/nginx-1.12.2'
make: *** [build] Error 2

我一次又一次地尝试但失败了。

答案1

要安装 nginx 软件,您可以使用 epel 存储库(如中所述这一页

第一步——添加 Nginx 存储库

要添加 CentOS 7 EPEL 存储库,请打开终端并使用以下命令:

sudo yum install epel-release

第二步——安装 Nginx

现在 Nginx 存储库已安装在您的服务器上,请使用以下 yum 命令安装 Nginx:

sudo yum install nginx

对提示回答“是”后,Nginx 将完成在虚拟专用服务器 (VPS) 上的安装。 第三步——启动 Nginx

Nginx 不会自行启动。要让 Nginx 运行,请输入:

sudo systemctl start nginx

相关内容