先日、FreeNAS 9にWebサーバのNginxをインストールしましたが試しにWordpressを動作させてみようと思います
OSはFreeNAS-9.1.1-RELEASE-x64 (a752d35)です
今回新たにJailホストを作成しました。またPorts Collectionが利用できるまでは以前の記事を参考にして下さい
Install nginx on FreeNAS 9
http://www.rootlinks.net/2013/10/27/install-nginx-on-freenas-9/
参考サイト
Setting up a FreeBSD 9 WordPress Server on 128MB of RAM
http://virtuallyhyper.com/2013/04/setting-up-freebsd-9-wordpress-server-on-128mb-of-ram/
WebサーバのNginxをインストールします
- コンパイルオプションを設定
- make
- make install
- make clean
- 自動起動設定
デフォルトオプションを確認してみます
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
root@vhost:/ # cd /usr/ports/www/nginx root@vhost:/usr/ports/www/nginx # make showconfig ===> The following configuration options are available for nginx-1.4.3,1: DEBUG=off: Install debug symbols DEBUGLOG=off: Enable debug log (--with-debug) FILE_AIO=off: Enable file aio IPV6=on: IPv6 protocol support GOOGLE_PERFTOOLS=off: Enable google perftools module HTTP=on: Enable HTTP module HTTP_ADDITION=off: Enable http_addition module HTTP_CACHE=on: Enable http_cache module HTTP_DAV=off: Enable http_webdav module HTTP_FLV=off: Enable http_flv module HTTP_GEOIP=off: Enable http_geoip module HTTP_GZIP_STATIC=off: Enable http_gzip_static module HTTP_GUNZIP_FILTER=off: Enable http_gunzip_filter module HTTP_IMAGE_FILTER=off: Enable http_image_filter module HTTP_PERL=off: Enable http_perl module HTTP_RANDOM_INDEX=off: Enable http_random_index module HTTP_REALIP=off: Enable http_realip module HTTP_REWRITE=on: Enable http_rewrite module HTTP_SECURE_LINK=off: Enable http_secure_link module HTTP_SSL=off: Enable http_ssl module HTTP_STATUS=on: Enable http_stub_status module HTTP_SUB=off: Enable http_sub module HTTP_XSLT=off: Enable http_xslt module MAIL=off: Enable IMAP4/POP3/SMTP proxy module MAIL_IMAP=off: Enable IMAP4 proxy module MAIL_POP3=off: Enable POP3 proxy module MAIL_SMTP=off: Enable SMTP proxy module MAIL_SSL=off: Enable mail_ssl module SPDY=off: Enable SPDY protocol support (SSL req.) WWW=on: Enable html sample files CACHE_PURGE=off: 3rd party cache_purge module CTPP2=off: 3rd party CT++ module ECHO=off: 3rd party echo module HEADERS_MORE=off: 3rd party headers_more module HTTP_ACCEPT_LANGUAGE=off: 3rd party accept_language module HTTP_ACCESSKEY=off: 3rd party http_accesskey module HTTP_AUTH_DIGEST=off: 3rd party http_authdigest module HTTP_AUTH_LDAP=off: 3rd party http_auth_ldap module HTTP_AUTH_PAM=off: 3rd party http_auth_pam module HTTP_AUTH_REQ=off: 3rd party http_auth_request module HTTP_DAV_EXT=off: 3rd party webdav_ext module HTTP_EVAL=off: 3rd party eval module HTTP_FANCYINDEX=off: 3rd party http_fancyindex module HTTP_MOGILEFS=off: 3rd party mogilefs module HTTP_NOTICE=off: 3rd party notice module HTTP_PUSH=off: 3rd party push module HTTP_PUSH_STREAM=off: 3rd party push stream module HTTP_REDIS=off: 3rd party http_redis module HTTP_RESPONSE=off: 3rd party http_response module HTTP_SUBS_FILTER=off: 3rd party subs filter module HTTP_UPLOAD=off: 3rd party upload module HTTP_UPLOAD_PROGRESS=off: 3rd party uploadprogress module HTTP_UPSTREAM_FAIR=off: 3rd party upstream fair module HTTP_UPSTREAM_HASH=off: 3rd party upstream hash module HTTP_UPSTREAM_STICKY=off: 3rd party upstream sticky module HTTP_ZIP=off: 3rd party http_zip module ARRAYVAR=off: 3rd party array_var module DRIZZLE=off: 3rd party drizzlie module ENCRYPTSESSION=off: 3rd party encrypted_session module FORMINPUT=off: 3rd party form_input module GRIDFS=off: 3rd party gridfs module ICONV=off: 3rd party iconv module LET=off: 3rd party let module LUA=off: 3rd party lua module MEMC=off: 3rd party memc (memcached) module MODSECURITY=off: 3rd party mod_security module NAXSI=off: 3rd party naxsi module PASSENGER=off: 3rd party passenger module POSTGRES=off: 3rd party postgresql module RDS_CSV=off: 3rd party rds_csv module RDS_JSON=off: 3rd party rds_json module REDIS2=off: 3rd party redis2 module RTMP=off: 3rd party rtmp module SET_MISC=off: 3rd party set_misc module SFLOW=off: 3rd party sflow module SLOWFS_CACHE=off: 3rd party slowfs_cache module SRCACHE=off: 3rd party srcache module SUPERVISORD=off: 3rd party supervisord module SYSLOG_SUPPORT=off: 3rd party syslog support TCP_PROXY=off: 3rd party tcp_proxy module UDPLOG=off: 3rd party udplog (syslog) module XRID_HEADER=off: 3rd party x-rid header module XSS=off: 3rd party xss module VIDEO=off: Video module support ====> Video module support: you have to select exactly one of them HTTP_MP4=off: Enable http_mp4 module HTTP_MP4_H264=off: 3rd party mp4/h264 module ===> Use 'make config' to modify these settings |
取り敢えず参考サイトに合わせてオプションの変更を行います
make config-recursiveは再帰的Configでportsの依存関係に合わせて必要なオプションをすべて設定する方法です
依存関係を確認する方法にmake all-depends-listがあります。デフォルトオプションの場合の依存関係を確認すると
1 2 3 |
root@vhost:/usr/ports/www/nginx # make all-depends-list /usr/ports/ports-mgmt/pkg /usr/ports/devel/pcre |
オプション設定でmake config-recursiveを何度か行ってダイアログ画面が表示しなくなるまで実行します
1 |
root@vhost:/usr/ports/www/nginx # make config-recursive |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
root@vhost:/usr/ports/www/nginx # make showconfig ===> The following configuration options are available for nginx-1.4.3,1: DEBUG=off: Install debug symbols DEBUGLOG=off: Enable debug log (--with-debug) FILE_AIO=off: Enable file aio IPV6=off: IPv6 protocol support GOOGLE_PERFTOOLS=off: Enable google perftools module HTTP=on: Enable HTTP module HTTP_ADDITION=on: Enable http_addition module HTTP_CACHE=off: Enable http_cache module HTTP_DAV=on: Enable http_webdav module HTTP_FLV=on: Enable http_flv module HTTP_GEOIP=on: Enable http_geoip module HTTP_GZIP_STATIC=on: Enable http_gzip_static module HTTP_GUNZIP_FILTER=off: Enable http_gunzip_filter module HTTP_IMAGE_FILTER=on: Enable http_image_filter module HTTP_PERL=on: Enable http_perl module HTTP_RANDOM_INDEX=on: Enable http_random_index module HTTP_REALIP=on: Enable http_realip module HTTP_REWRITE=on: Enable http_rewrite module HTTP_SECURE_LINK=on: Enable http_secure_link module HTTP_SSL=on: Enable http_ssl module HTTP_STATUS=on: Enable http_stub_status module HTTP_SUB=on: Enable http_sub module HTTP_XSLT=on: Enable http_xslt module MAIL=off: Enable IMAP4/POP3/SMTP proxy module MAIL_IMAP=off: Enable IMAP4 proxy module MAIL_POP3=off: Enable POP3 proxy module MAIL_SMTP=off: Enable SMTP proxy module MAIL_SSL=off: Enable mail_ssl module SPDY=off: Enable SPDY protocol support (SSL req.) WWW=on: Enable html sample files CACHE_PURGE=off: 3rd party cache_purge module CTPP2=off: 3rd party CT++ module ECHO=off: 3rd party echo module HEADERS_MORE=off: 3rd party headers_more module HTTP_ACCEPT_LANGUAGE=off: 3rd party accept_language module HTTP_ACCESSKEY=off: 3rd party http_accesskey module HTTP_AUTH_DIGEST=off: 3rd party http_authdigest module HTTP_AUTH_LDAP=off: 3rd party http_auth_ldap module HTTP_AUTH_PAM=off: 3rd party http_auth_pam module HTTP_AUTH_REQ=off: 3rd party http_auth_request module HTTP_DAV_EXT=off: 3rd party webdav_ext module HTTP_EVAL=off: 3rd party eval module HTTP_FANCYINDEX=off: 3rd party http_fancyindex module HTTP_MOGILEFS=off: 3rd party mogilefs module HTTP_NOTICE=off: 3rd party notice module HTTP_PUSH=off: 3rd party push module HTTP_PUSH_STREAM=off: 3rd party push stream module HTTP_REDIS=off: 3rd party http_redis module HTTP_RESPONSE=off: 3rd party http_response module HTTP_SUBS_FILTER=off: 3rd party subs filter module HTTP_UPLOAD=off: 3rd party upload module HTTP_UPLOAD_PROGRESS=off: 3rd party uploadprogress module HTTP_UPSTREAM_FAIR=off: 3rd party upstream fair module HTTP_UPSTREAM_HASH=off: 3rd party upstream hash module HTTP_UPSTREAM_STICKY=off: 3rd party upstream sticky module HTTP_ZIP=off: 3rd party http_zip module ARRAYVAR=off: 3rd party array_var module DRIZZLE=off: 3rd party drizzlie module ENCRYPTSESSION=off: 3rd party encrypted_session module FORMINPUT=off: 3rd party form_input module GRIDFS=off: 3rd party gridfs module ICONV=off: 3rd party iconv module LET=off: 3rd party let module LUA=off: 3rd party lua module MEMC=off: 3rd party memc (memcached) module MODSECURITY=off: 3rd party mod_security module NAXSI=off: 3rd party naxsi module PASSENGER=off: 3rd party passenger module POSTGRES=off: 3rd party postgresql module RDS_CSV=off: 3rd party rds_csv module RDS_JSON=off: 3rd party rds_json module REDIS2=off: 3rd party redis2 module RTMP=off: 3rd party rtmp module SET_MISC=off: 3rd party set_misc module SFLOW=off: 3rd party sflow module SLOWFS_CACHE=off: 3rd party slowfs_cache module SRCACHE=off: 3rd party srcache module SUPERVISORD=off: 3rd party supervisord module SYSLOG_SUPPORT=off: 3rd party syslog support TCP_PROXY=off: 3rd party tcp_proxy module UDPLOG=off: 3rd party udplog (syslog) module XRID_HEADER=off: 3rd party x-rid header module XSS=off: 3rd party xss module VIDEO=off: Video module support ====> Video module support: you have to select exactly one of them HTTP_MP4=off: Enable http_mp4 module HTTP_MP4_H264=off: 3rd party mp4/h264 module ===> Use 'make config' to modify these settings |
選択したオプションが増えたので必要なportsの依存関係も増えました
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 |
root@vhost:/usr/ports/www/nginx # make all-depends-list /usr/ports/ports-mgmt/pkg /usr/ports/lang/perl5.14 /usr/ports/net/GeoIP /usr/ports/graphics/gd /usr/ports/devel/pcre /usr/ports/textproc/libxml2 /usr/ports/textproc/libxslt /usr/ports/devel/libtool /usr/ports/devel/pkgconf /usr/ports/graphics/jpeg /usr/ports/graphics/tiff /usr/ports/graphics/png /usr/ports/print/freetype2 /usr/ports/x11-fonts/fontconfig /usr/ports/devel/gmake /usr/ports/converters/libiconv /usr/ports/security/libgcrypt /usr/ports/x11/glproto /usr/ports/x11/dri2proto /usr/ports/x11/libSM /usr/ports/x11/libICE /usr/ports/x11-toolkits/libXmu /usr/ports/x11/libXi /usr/ports/x11/libX11 /usr/ports/graphics/jbigkit /usr/ports/graphics/freeglut /usr/ports/graphics/libGLU /usr/ports/graphics/libGL /usr/ports/devel/cmake /usr/ports/textproc/expat2 /usr/ports/devel/gettext /usr/ports/security/libgpg-error /usr/ports/devel/xorg-macros /usr/ports/x11/xtrans /usr/ports/x11/xproto /usr/ports/x11-toolkits/libXt /usr/ports/x11/libXext /usr/ports/x11/xextproto /usr/ports/x11/inputproto /usr/ports/x11/libXfixes /usr/ports/x11/bigreqsproto /usr/ports/x11/xcmiscproto /usr/ports/x11/kbproto /usr/ports/x11-fonts/xf86bigfontproto /usr/ports/x11/libXau /usr/ports/x11/libXdmcp /usr/ports/x11/libxcb /usr/ports/x11/libXxf86vm /usr/ports/x11/libXrandr /usr/ports/devel/makedepend /usr/ports/lang/python2 /usr/ports/textproc/py-libxml2 /usr/ports/textproc/flex /usr/ports/lang/python27 /usr/ports/lang/python /usr/ports/devel/bison /usr/ports/x11/libXdamage /usr/ports/graphics/libdrm /usr/ports/devel/cmake-modules /usr/ports/x11/fixesproto /usr/ports/devel/libcheck /usr/ports/x11/xcb-proto /usr/ports/devel/libpthread-stubs /usr/ports/x11/xf86vidmodeproto /usr/ports/x11/randrproto /usr/ports/x11/renderproto /usr/ports/x11/libXrender /usr/ports/misc/help2man /usr/ports/devel/m4 /usr/ports/x11/damageproto /usr/ports/devel/libpciaccess /usr/ports/devel/p5-Locale-gettext /usr/ports/misc/pciids |
コンパイルを行います。
依存関係に合わせて必要なportsをダウンロード、コンパイルしますので時間は掛かります
1 |
root@vhost:/usr/ports/www/nginx # make |
ちなみに
1 |
root@vhost:/usr/ports/www/nginx # make install clean |
でコンパイル、インストール、作業ファイルの削除などの後始末まで一連の作業を行ってくれます
コンパイルしたプログラムをインストールします
1 2 3 4 5 6 7 8 9 |
root@vhost:/usr/ports/www/nginx # make install ===> Staging for nginx-1.4.3,1 ===> nginx-1.4.3,1 depends on file: /usr/local/bin/perl5.14.4 - found ===> nginx-1.4.3,1 depends on shared library: libGeoIP.so - found ===> nginx-1.4.3,1 depends on shared library: libgd.so - found ===> nginx-1.4.3,1 depends on shared library: libpcre.so - found ===> nginx-1.4.3,1 depends on shared library: libxml2.so - found ===> nginx-1.4.3,1 depends on shared library: libxslt.so - found (snip) |
不要なファイルを削除します
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
root@vhost:/usr/ports/www/nginx # make clean ===> Cleaning for GeoIP-1.4.8_3 ===> Cleaning for libgd-2.1.0_1,1 ===> Cleaning for libxslt-1.1.28_1 ===> Cleaning for libtool-2.4.2_2 ===> Cleaning for jpeg-8_4 ===> Cleaning for tiff-4.0.3 ===> Cleaning for png-1.5.17 ===> Cleaning for freetype2-2.5.0.1 ===> Cleaning for fontconfig-2.10.95,1 ===> Cleaning for gmake-3.82_1 ===> Cleaning for libgcrypt-1.5.3 ===> Cleaning for glproto-1.4.16 ===> Cleaning for dri2proto-2.8 ===> Cleaning for libXmu-1.1.2,1 ===> Cleaning for libXi-1.7.2,1 ===> Cleaning for jbigkit-1.6 ===> Cleaning for freeglut-2.8.1 ===> Cleaning for libGLU-9.0.0 ===> Cleaning for libGL-7.6.1_4 ===> Cleaning for cmake-2.8.12 ===> Cleaning for libgpg-error-1.12 ===> Cleaning for xorg-macros-1.17.1 ===> Cleaning for libXt-1.1.4,1 ===> Cleaning for libXext-1.3.2,1 ===> Cleaning for xextproto-7.2.1 ===> Cleaning for inputproto-2.3 ===> Cleaning for libXfixes-5.0.1 ===> Cleaning for libXxf86vm-1.1.3 ===> Cleaning for libXrandr-1.4.2 ===> Cleaning for makedepend-1.0.5,1 ===> Cleaning for flex-2.5.37_1 ===> Cleaning for bison-2.7.1,1 ===> Cleaning for libXdamage-1.1.4 ===> Cleaning for libdrm-2.4.17_1 ===> Cleaning for cmake-modules-2.8.12 ===> Cleaning for fixesproto-5.0 ===> Cleaning for xf86vidmodeproto-2.3.1 ===> Cleaning for randrproto-1.4.0 ===> Cleaning for renderproto-0.11.1 ===> Cleaning for libXrender-0.9.8 ===> Cleaning for help2man-1.43.3 ===> Cleaning for m4-1.4.17,1 ===> Cleaning for damageproto-1.2.1 ===> Cleaning for libpciaccess-0.13.2 ===> Cleaning for p5-Locale-gettext-1.05_3 ===> Cleaning for pciids-20131110 ===> Cleaning for nginx-1.4.3,1 |
ホスト起動時にNginxが自動起動するように設定します
1 2 3 4 5 6 7 8 9 10 11 12 13 |
root@vhost:/usr/ports/www/nginx # echo 'nginx_enable="YES"' >> /etc/rc.conf root@vhost:/usr/ports/www/nginx # cat /etc/rc.conf portmap_enable="NO" sshd_enable="YES" sendmail_enable="NO" sendmail_submit_enable="NO" sendmail_outbound_enable="NO" sendmail_msp_queue_enable="NO" hostname="vhost" devfs_enable="YES" devfs_system_ruleset="devfsrules_common" nginx_enable="YES" |