読者です 読者をやめる 読者になる 読者になる

DELAEMON BLOG

Live as if you were to die tomorrow. Learn as if you were to live forever.

nginx build form source on Fedora23 Server (OSX VirtualBox)

OSX VirtualBox上のまっさらなFedora23Serverにnginxをsourceからビルド

最短距離

$ sudo dnf install git gcc pcre-devel zlib-devel openssl-devel
$ git clone https://github.com/nginx/nginx.git
$ cd nginx
$ ./auto/configure --with-openssl=/usr/lib64/openssl
$ make
$ sudo make install
$ sudo chmod +x /usr/local/nginx/sbin/nginx
$ sudo /usr/local/nginx/sbin/nginx -V
nginx version: nginx/1.9.10
built by gcc 5.3.1 20151207 (Red Hat 5.3.1-2) (GCC)
configure arguments: --with-openssl=/usr/lib64/openssl
$ sudo firewall-cmd --permanent --add-service=http
success
$ sudo firewall-cmd --permanent --add-port=80/tcp
success
$ sudo systemctl restart firewalld
$ sudo firewall-cmd --list-all
FedoraServer (default, active)
  interfaces: enp0s3
  sources:
  services: cockpit dhcpv6-client http https ssh
  ports: 80/tcp
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules:

以下、遭遇したエラー

gccがない
$ ./auto/configure
checking for OS
 + Linux 4.2.3-300.fc23.x86_64 x86_64
checking for C compiler ... not found

./auto/configure: error: C compiler cc is not found

gccを入れる

$ sudo dnf install gcc
pcreがない
$ ./auto/configure
~ 省略
checking for PCRE library ... not found
checking for PCRE library in /usr/local/ ... not found
checking for PCRE library in /usr/include/pcre/ ... not found
checking for PCRE library in /usr/pkg/ ... not found
checking for PCRE library in /opt/local/ ... not found

./auto/configure: error: the HTTP rewrite module requires the PCRE library.
You can either disable the module by using --without-http_rewrite_module
option, or install the PCRE library into the system, or build the PCRE library
statically from the source with nginx by using --with-pcre=<path> option.

pcreを入れる

$ sudo dnf install pcre-develop
zlibがない
$ ./auto/configure
~ 省略
checking for zlib library ... not found

./auto/configure: error: the HTTP gzip module requires the zlib library.
You can either disable the module by using --without-http_gzip_module
option, or install the zlib library into the system, or build the zlib library
statically from the source with nginx by using --with-zlib=<path> option.

zilbを入れる

$ sudo dnf install zlib-devel
opensslがない
$ ./auto/configure
~ 省略

Configuration summary
  + using system PCRE library
  + OpenSSL library is not used
  + using builtin md5 code
  + sha1 library is not found
  + using system zlib library

opensslを入れる、オプション指定する

$ sudo dnf install openssl-devel
$ ./auto/configure --with-openssl=/usr/lib64/openssl
port 80に接続できない

firewalldで許可する

$ sudo firewall-cmd --permanent --add-service=http
success
$ sudo firewall-cmd --permanent --add-port=80/tcp
success
$ sudo systemctl restart firewalld
$ sudo firewall-cmd --list-all
FedoraServer (default, active)
  interfaces: enp0s3
  sources:
  services: cockpit dhcpv6-client http https ssh
  ports: 80/tcp
  masquerade: no
  forward-ports:
  icmp-blocks:
  rich rules: