centos7에서 nginx를 만드는 중 오류가 발생했습니다.

centos7에서 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 install 하면 오류가 발생합니다. 오류의 일부는 다음과 같습니다.

     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 저장소를 사용할 수 있습니다.이 페이지)

1단계 - Nginx 저장소 추가

CentOS 7 EPEL 저장소를 추가하려면 터미널을 열고 다음 명령을 사용하십시오.

sudo yum install epel-release

2단계 - Nginx 설치

이제 Nginx 저장소가 서버에 설치되었으므로 다음 yum 명령을 사용하여 Nginx를 설치하십시오.

sudo yum install nginx

프롬프트에 "예"라고 대답하면 Nginx는 VPS(Virtual Private Server)에 설치를 완료합니다. 3단계 - Nginx 시작

Nginx는 자체적으로 시작되지 않습니다. Nginx를 실행하려면 다음을 입력하세요.

sudo systemctl start nginx

관련 정보