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はVirtual Private Server(VPS)へのインストールを完了します。 ステップ3 - Nginxを起動

Nginxはそれ自体では起動しません。 Nginxを実行するには、次のように入力します。

sudo systemctl start nginx

おすすめ記事