Apache
The Joyent Apache image is a SmartOS base64 image pre-configured with Apache, an open source, highly modular stable web server.
You can find more information about Apache at their website.
- Overview
- Directory layout
- Starting Apache
- Configuration
- Virtual hosts
- Memory usage
- DTracing Apache
- Metadata keys
- 15.x.x
- 14.x.x
Overview
Apache comes pre-installed and tuned according to your VM size under the www user as the SMF service svc:/pkgsrc/apache:default
. The instance also comes pre-configured with a virtual host listening on all interfaces with PHP support.
Directory layout
The directory and file layout is as follows:
Directory/File | Description |
---|---|
/opt/local/sbin |
Holds Apache server binaries |
/opt/local/etc/httpd |
The configuration directory for Apache |
/opt/local/etc/httpd/virtualhosts |
The virtual hosts configuration directory for Apache |
/var/log/httpd |
Where Apache access and error logs are kept |
/var/log/php-fpm.log |
Log file for php-fpm |
/home/admin/web/public |
Docroot for the default virtual host |
Starting Apache
By default Apache comes enabled. You can disable, restart the service with:
# svcadm disable pkgsrc/apache
or restart:
# svcadm restart pkgsrc/apache
To check the status of the service:
# svcs pkgsrc/apache
online May_12 svc:/pkgsrc/apache:default
Configuration
The Apache configuration files are stored at /opt/local/etc/httpd
and virtual host files at /opt/local/etc/httpd/virtualhosts
.
Virtual hosts
Default virtual host
By default the instance comes pre-configured with a virtual host listening on all interfaces. The configurations for these are at /opt/local/etc/httpd/virtualhosts/<x.x.x.x>.conf
with docroot directory /home/admin/web/public
. If this configuration works for you (behind a load balancer) then you can just drop in your static files there.
Create a Virtual Host with sm-create-vhost
To add a new virtual host you can enter one in manually in the configuration directory (/opt/local/etc/httpd/virtualhosts
) or use the sm-create-vhost helper script which comes in the smtools package.
Creating a new virtual host with sm-create-vhost:
* Created Apache configuration /opt/local/etc/httpd/virtualhosts/example.com.conf.
Settings:
Hosts: example.com *.example.com www.example.com
Port: 80
Docroot: /home/admin/web/example.com
For changes to take you will need:
Include etc/httpd/virtualhosts/*.conf
in your /opt/local/etc/httpd/httpd.conf and restart apache with:
# svcadm restart pkgsrc/apache
Memory usage
Monitoring the processes memory usages is easy with project support.
Apache memory usage can be monitored under the www project using prstat -J
. PHP memory usage can also be monitored this way under the php project.
# prstat -J
PROJID NPROC SWAP RSS MEMORY TIME CPU PROJECT
0 16 72M 44M 0.0% 0:00:58 0.0% system
925 2 18M 5548K 0.0% 0:00:00 0.0% www
926 3 68M 9876K 0.0% 0:00:00 0.0% php
DTracing Apache
The Apache instance comes with mod_usdt already enabled to provide DTrace inspection, and the dtracetools package installed which has two scripts to start tracing. Here are the examples (you must use the -L
option on these scripts):
Example #1 - dtrace-apache_requests.d
# dtrace-apache_requests.d -L /opt/local/lib/dtrace
time latency sta local remote method uri
7.082 321us 200 x.x.x.x:80 x.x.x.x:57383 GET /
8.904 286us 304 x.x.x.x:80 x.x.x.x:57383 GET /
Example #2 - dtrace-apache_requests_bylatency.d
# dtrace-apache_requests_bylatency.d -L /opt/local/lib/dtrace
Tracing. Hit CTRL-C to stop.
^C
microseconds
value ------------- Distribution ------------- count
64 | 0
128 |@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ 3
256 |@@@@@@@@@@ 1
512 | 0
Metadata keys
With the Apache image are metadata keys that can be pre-defined during provision to provide additional customization to the instance.
Metadata Key | Description |
---|---|
php_zend | On = Sets PHP ZendOptimizer on |
Version 15.x.x
15.4.1
Name | apache |
Description | A SmartOS 64-bit image pre-configured and optimized as an Apache 2.4.17 Server with Event MPM and PHP-FPM. Comes packaged with a default virtual host listening on all interfaces. |
UUID | 7c56d790-07d0-11e6-aeca-5350b4486f63 |
Based on | base-64-lts 15.4.1 |
Pkgsrc | 2015Q4 |
What's New In This Image
- Base image is base-64-lts-15.4.1 (2015Q4)
- Apache version is 2.4.17
- PHP FPM version is 5.6.19
- PHP version is 5.6.19
Software Included In This Image
Software installed as pkgsrc packages:
apache-2.4.17 Apache HTTP (Web) server, version 2.4
apachetop-0.12.5nb4 Real time apache log display
bzip2-1.0.6nb1 Block-sorting file compressor
curl-7.47.1 Client that groks URLs
db4-4.8.30 Berkeley DB version 4 from Oracle
dtracetools-0.7nb20160127 DTraceTools for Joyent SmartMachines
gcc47-libs-4.7.4nb1 The GNU Compiler Collection (GCC) support shared libraries
gcc49-libs-4.9.3nb1 The GNU Compiler Collection (GCC) support shared libraries
gtar-base-1.28nb1 The GNU tape archiver with remote magnetic tape support
htop-1.0.1nb1 Enhanced version of top utility
nodejs-5.10.0 V8 JavaScript for clients and servers
openssl-1.0.2g Secure Socket Layer and cryptographic library
perl-5.22.0 Practical Extraction and Report Language
php-5.6.19 PHP Hypertext Preprocessor version 5.6
php56-bcmath-5.6.19 PHP extension for bc-style arbitrary precision math
php56-bz2-5.6.19 PHP extension for bzip2 compression
php56-calendar-5.6.19 PHP extension for calendar conversion support
php56-curl-5.6.19 PHP extension for curl functions
php56-dom-5.6.19 PHP5 extension for DOM support
php56-fpm-5.6.19nb1 FPM interface for PHP5.6
php56-gd-5.6.19 PHP extension for GD graphics library
php56-gettext-5.6.19 PHP extension for gettext support
php56-gmp-5.6.19 PHP extension for arbitrary precision math
php56-iconv-5.6.19 PHP extension for character set conversion
php56-imap-5.6.19 PHP extension for IMAP (Internet Mailbox Access Protocol)
php56-json-5.6.19 PHP extension for JSON serialization support
php56-mbstring-5.6.19 PHP extension for multibyte characters support
php56-mcrypt-5.6.19 PHP extension for the mcrypt crypto algorithms library
php56-memcache-2.2.7 PHP extension for memcached
php56-memcached-2.2.0nb1 PHP extension for interfacing with memcached via libmemcached library
php56-mysql-5.6.19 PHP extension for MySQL databases
php56-mysqli-5.6.19 PHP5 extension for MySQL 4.1 and later databases
php56-opcache-5.6.19 PHP extension for opcode caching
php56-pdo-5.6.19 PHP extension for PHP Data Objects (base)
php56-pdo_mysql-5.6.19 PHP extension for PHP Data Objects (MySQL)
php56-pdo_sqlite-5.6.19 PHP extension for PHP Data Objects (SQLite v3)
php56-pear-1.10.1 PEAR Base System for PHP
php56-posix-5.6.19 PHP extension for POSIX-like functions
php56-soap-5.6.19 PHP extension for SOAP functions
php56-xmlrpc-5.6.19 PHP extension for XML-RPC support
php56-xsl-5.6.19 PHP extension for XSLT functions
php56-zip-5.6.19 PHP extension for ZIP archive handling
php56-zlib-5.6.19 PHP extension for zlib compression
pkgin-0.9.4 Apt / yum like tool for managing pkgsrc binary packages
postfix-3.0.2nb2 Postfix SMTP server and tools
python27-2.7.11 Interpreted, interactive, object-oriented programming language
smtools-20160316 Joyent tools relevant to SmartOS and SmartMachines
sqlite3-3.9.2 SQL Database Engine in a C Library
sudo-1.8.15 Allow others to run commands as root
wget-1.17.1 Retrieve files from the 'net via HTTP and FTP
zoneinit-1.6.8 Joyent Instance initialization toolchain
Software installed as npm packages:
json@9.0.3
manta@2.0.6
smartdc@8.1.0
15.1.2
Name | apache |
Description | A SmartOS 64-bit image pre-configured and optimized as an Apache 2.4.12 Server with Event MPM and PHP-FPM. Comes packaged with a default virtual host listening on all interfaces. |
UUID | b53bead6-766d-11e5-8854-a729d3480de9 |
Based on | base-64 15.1.0 |
Pkgsrc | 2015Q1 |
What's New In This Image
- Base image is base-64-15.1.2 (2015Q1)
- Apache version is 2.4.12
- PHP FPM version is 5.5.26
- PHP version is 5.5.26
- Fixed bug where PHP was not functional by default
Software Included In This Image
Software installed as pkgsrc packages:
apache-2.4.12
apachetop-0.12.5nb2
bzip2-1.0.6nb1
curl-7.42.0
db4-4.8.30
dtracetools-0.7
gcc47-libs-4.7.4nb1
gtar-base-1.28nb1
htop-1.0.1
nodejs-0.12.7
openssl-1.0.2a
perl-5.20.2
php-5.5.26
php55-bcmath-5.5.26
php55-bz2-5.5.26
php55-calendar-5.5.26
php55-curl-5.5.26
php55-dom-5.5.26
php55-fpm-5.5.26
php55-gd-5.5.26
php55-gettext-5.5.26
php55-gmp-5.5.26
php55-iconv-5.5.26
php55-imap-5.5.26
php55-json-5.5.26
php55-mbstring-5.5.26
php55-mcrypt-5.5.26
php55-memcache-2.2.7
php55-memcached-2.2.0
php55-mysql-5.5.26
php55-mysqli-5.5.26
php55-pdo-5.5.26
php55-pdo_mysql-5.5.26
php55-pdo_sqlite-5.5.26
php55-pear-1.9.5nb3
php55-posix-5.5.26
php55-soap-5.5.26
php55-xmlrpc-5.5.26
php55-xsl-5.5.26
php55-zendopcache-7.0.4
php55-zip-5.5.26
php55-zlib-5.5.26
pkgin-0.8.0
postfix-2.11.4
python27-2.7.9nb1
smtools-20150312
sqlite3-3.8.8.3
sudo-1.7.10p9
wget-1.16.3
zoneinit-1.6.8
Software installed as npm packages:
json@9.0.3
manta@2.0.2
smartdc@7.5.3
15.1.1
Name | apache |
Description | A SmartOS 64-bit image pre-configured and optimized as an Apache 2.4.12 Server with Event MPM and PHP-FPM. Comes packaged with a default virtual host listening on all interfaces. |
UUID | 6af52578-088b-11e5-bf8c-1b9bffb30b77 |
Based on | base-64 15.1.1 |
Pkgsrc | 2015Q1 |
What's New In This Image
- Base image is base-64-15.1.1 (2015Q1)
- Apache version is 2.4.12
- PHP FPM version is 5.5.25
- PHP version is 5.5.25
Software Included In This Image
Software installed as pkgsrc packages:
apache-2.4.12
apachetop-0.12.5nb2
bzip2-1.0.6nb1
curl-7.42.0
db4-4.8.30
dtracetools-0.7
gcc47-libs-4.7.4nb1
gtar-base-1.28nb1
htop-1.0.1
nodejs-0.12.4
openssl-1.0.2a
perl-5.20.2
php-5.5.25
php55-bcmath-5.5.25
php55-bz2-5.5.25
php55-calendar-5.5.25
php55-curl-5.5.25
php55-dom-5.5.25
php55-fpm-5.5.25
php55-gd-5.5.25
php55-gettext-5.5.25
php55-gmp-5.5.25
php55-iconv-5.5.25
php55-imap-5.5.25
php55-json-5.5.25
php55-mbstring-5.5.25
php55-mcrypt-5.5.25
php55-memcache-2.2.7
php55-memcached-2.2.0
php55-mysql-5.5.25
php55-mysqli-5.5.25
php55-pdo-5.5.25
php55-pdo_mysql-5.5.25
php55-pdo_sqlite-5.5.25
php55-pear-1.9.5nb3
php55-posix-5.5.25
php55-soap-5.5.25
php55-xmlrpc-5.5.25
php55-xsl-5.5.25
php55-zendopcache-7.0.4
php55-zip-5.5.25
php55-zlib-5.5.25
pkgin-0.8.0
postfix-2.11.4
python27-2.7.9nb1
smtools-20150312
sqlite3-3.8.10
sudo-1.7.10p9
wget-1.16.3
zoneinit-1.6.8
Software installed as npm packages:
json@9.0.3
manta@1.5.1
smartdc@7.3.1
Version 14.x.x
14.4.0
Name | apache |
Description | A SmartOS 64-bit image pre-configured and optimized as an Apache 2.4.10 Server with Event MPM and PHP-FPM. Comes packaged with a default virtual host listening on all interfaces. |
UUID | cdc1635a-cceb-11e4-bfd5-f37e28be465c |
Based on | base-64-lts 14.4.0 |
Pkgsrc | 2014Q4 |
What's new in this image
- Base image is base-64-lts-14.4.0 (2014Q4)
- Apache version is 2.4.10
- PHP FPM version is 5.5.22
- PHP version is 5.5.22
- Metadata key 'php_zend' can be pre-defined during provision turn zend optimizer on
Software included in this image
Software installed as pkgsrc packages:
apache-2.4.10nb3
apachetop-0.12.5nb2
bzip2-1.0.6nb1
curl-7.39.0nb1
db4-4.8.30
dtracetools-0.7
gcc47-libs-4.7.3nb7
gtar-base-1.28
htop-1.0.1
nodejs-0.12.0
openssl-1.0.1k
perl-5.20.1
php-5.5.22
php55-bcmath-5.5.22
php55-bz2-5.5.22
php55-calendar-5.5.22
php55-curl-5.5.22nb1
php55-dom-5.5.22nb1
php55-fpm-5.5.22
php55-gd-5.5.22nb1
php55-gettext-5.5.22
php55-gmp-5.5.22
php55-iconv-5.5.22
php55-imap-5.5.22nb1
php55-json-5.5.22
php55-mbstring-5.5.22
php55-mcrypt-5.5.22
php55-memcache-2.2.7
php55-memcached-2.2.0
php55-mysql-5.5.22
php55-mysqli-5.5.22
php55-pdo-5.5.22
php55-pdo_mysql-5.5.22
php55-pdo_sqlite-5.5.22nb2
php55-pear-1.9.5nb2
php55-posix-5.5.22
php55-soap-5.5.22
php55-xmlrpc-5.5.22nb1
php55-xsl-5.5.22nb1
php55-zendoptimizerplus-7.0.0
php55-zip-5.5.22
php55-zlib-5.5.22nb1
pkgin-0.7.0
postfix-2.11.3
python27-2.7.9
smtools-20150226
sqlite3-3.8.7.4
sudo-1.7.10p9
wget-1.16.1
zoneinit-1.6.8
Software installed as npm packages:
json@9.0.3
manta@1.5.0
smartdc@7.3.1
14.3.0
Name | apache |
Description | A SmartOS 64-bit image pre-configured and optimized as an Apache 2.4.10 Server with Event MPM and PHP-FPM. Comes packaged with a default virtual host listening on all interfaces. |
UUID | 28b59658-7a50-11e4-b5ec-6b4f767837d5 |
Based on | base64 14.3.0 |
Pkgsrc | 2014Q3 |
What's new in this image
- Base image is base64-14.3.0 (2014Q3)
- Apache version is 2.4.10
- PHP FPM version is 5.5.18
- PHP version is 5.5.18
- Enabled common PHP extensions by default
Software included in this image
Software installed as pkgsrc packages:
apache-2.4.10nb1
apachetop-0.12.5nb2
bzip2-1.0.6nb1
curl-7.38.0
db4-4.8.30
gcc47-libs-4.7.3nb7
gtar-base-1.28
nodejs-0.10.33
openssl-1.0.1j
perl-5.20.0nb2
php-5.5.18
php55-bcmath-5.5.18
php55-bz2-5.5.18
php55-calendar-5.5.18
php55-curl-5.5.18nb1
php55-dom-5.5.18nb1
php55-fpm-5.5.18
php55-gd-5.5.18nb1
php55-gettext-5.5.18
php55-gmp-5.5.18
php55-iconv-5.5.18
php55-imap-5.5.18nb1
php55-json-5.5.18
php55-mbstring-5.5.18
php55-mcrypt-5.5.18
php55-memcache-2.2.7
php55-memcached-2.2.0
php55-mysql-5.5.18
php55-mysqli-5.5.18
php55-pdo-5.5.18
php55-pdo_mysql-5.5.18
php55-pdo_sqlite-5.5.18nb1
php55-pear-1.9.5nb1
php55-posix-5.5.18
php55-soap-5.5.18
php55-xmlrpc-5.5.18nb1
php55-xsl-5.5.18nb1
php55-zendoptimizerplus-7.0.0
php55-zip-5.5.18
php55-zlib-5.5.18nb1
pkgin-0.6.4nb7
postfix-2.11.1nb1
python27-2.7.8nb1
smtools-20141114
sqlite3-3.8.6
sudo-1.7.10p8
wget-1.16
zoneinit-1.6.8
Software installed as npm packages
manta@1.4.5
smartdc@7.3.0
14.2.0
Name | apache |
Description | A SmartOS 64-bit image pre-configured and optimized as an Apache 2.4.9 Server with Event MPM and PHP-FPM. Comes packaged with a default virtual host listening on all interfaces. |
UUID | 12d50dd0-27a5-11e4-bcda-13716a62b193 |
Based on | base64 14.2.0 |
pkgsrc | 2014Q2 |
What's new in this image
- Base image is base64-14.2.0 (2014Q2)
- Apache version is 2.4.10
- PHP FPM version is 5.5.14
- PHP version is 5.5.14
Software included in this image
Software installed as pkgsrc packages:
apache-2.4.10
apachetop-0.12.5nb2
bzip2-1.0.6nb1
curl-7.37.0nb1
db4-4.8.30
gcc47-libs-4.7.3nb4
gtar-base-1.27.1nb1
libarchive-2.8.4nb4
nodejs-0.10.30
openssl-1.0.1h
perl-5.20.0nb1
php-5.5.14nb1
php55-bcmath-5.5.14
php55-bz2-5.5.14
php55-calendar-5.5.14
php55-curl-5.5.14nb1
php55-dom-5.5.14nb1
php55-fpm-5.5.14
php55-gd-5.5.14nb1
php55-gettext-5.5.14
php55-gmp-5.5.14
php55-iconv-5.5.14
php55-imap-5.5.14nb1
php55-json-5.5.14
php55-mbstring-5.5.14
php55-mcrypt-5.5.14
php55-memcache-2.2.7
php55-memcached-2.2.0
php55-mysql-5.5.14
php55-mysqli-5.5.14
php55-pdo-5.5.14
php55-pdo_mysql-5.5.14
php55-pdo_sqlite-5.5.14nb1
php55-pear-1.9.4nb4
php55-posix-5.5.14
php55-soap-5.5.14
php55-xmlrpc-5.5.14
php55-xsl-5.5.14nb1
php55-zendoptimizerplus-7.0.0
php55-zip-5.5.14
php55-zlib-5.5.14nb1
pkgin-0.6.4nb7
postfix-2.11.1nb1
python27-2.7.7nb2
smtools-20140728
sqlite3-3.8.5
sudo-1.7.10p8
wget-1.15nb2
zoneinit-1.6.8
Software installed as npm packages
jsontool@7.0.2
manta@1.4.2
smartdc@7.3.0
14.1.0
Name | apache |
Description | A SmartOS 64-bit image pre-configured and optimized as an Apache 2.4.9 Server with Event MPM and PHP-FPM. Comes packaged with a default virtual host listening on all interfaces. |
UUID | be8e99f8-0841-11e4-8770-6b84cf85e8e8 |
Based on | base64 14.1.0 |
pkgsrc | 2014Q1 |
What's new in this image
- Base image is base64-14.1.0 (2014Q1)
- Apache version is 2.4.9
- PHP FPM version is 5.5.10
- PHP version is 5.5.10
- Apache pre-configured to use event MPM and tuned by default
- Default virtualhost listening on all interfaces
- Apache and php-fpm enabled by default
- Apache DTrace support enabled by default
Software included in this image
Software installed as pkgsrc packages:
apache-2.4.9
apachetop-0.12.5nb2
bzip2-1.0.6nb1
curl-7.36.0
db4-4.8.30
duo-unix-1.9.7
gcc47-libs-4.7.3nb3
gtar-base-1.27.1nb1
nodejs-0.10.29
openssl-1.0.1g
perl-5.18.2nb1
php-5.5.10nb2
php55-bcmath-5.5.10
php55-bz2-5.5.10
php55-calendar-5.5.10
php55-curl-5.5.10nb1
php55-dom-5.5.10nb1
php55-fpm-5.5.10
php55-gd-5.5.10
php55-gettext-5.5.10
php55-gmp-5.5.10
php55-iconv-5.5.10
php55-imap-5.5.10nb1
php55-json-5.5.10
php55-mbstring-5.5.10
php55-mcrypt-5.5.10
php55-memcache-2.2.7
php55-memcached-2.1.0
php55-mysql-5.5.10
php55-mysqli-5.5.10
php55-pdo-5.5.10
php55-pdo_mysql-5.5.10
php55-pdo_sqlite-5.5.10
php55-pear-1.9.4nb4
php55-posix-5.5.10
php55-soap-5.5.10
php55-xmlrpc-5.5.10
php55-xsl-5.5.10nb1
php55-zendoptimizerplus-7.0.0
php55-zip-5.5.10
php55-zlib-5.5.10nb1
pkgin-0.6.4nb5
postfix-2.11.0nb1
python27-2.7.6nb3
smtools-20140709
sqlite3-3.8.4.1
sudo-1.7.10p8
wget-1.15nb1
zoneinit-1.6.7
Software installed as npm packages
jsontool@7.0.2
manta@1.2.7
smartdc@7.2.1