Difference between pages "Package:Nginx" and "Package:ACPI Daemon"

From Funtoo
(Difference between pages)
Jump to: navigation, search
 
 
Line 1: Line 1:
 
{{Ebuild
 
{{Ebuild
|Summary=Robust, small and high performance HTTP and reverse proxy server
+
|Summary=Daemon for Advanced Configuration and Power Interface
|CatPkg=www-servers/nginx
+
|CatPkg=sys-power/acpid
|Maintainer=Daniel Robbins, Golodhrim,
+
|Repository=Gentoo Portage Tree
|Repository=Funtoo Overlay
+
|Overlay=Funtoo
+
 
}}
 
}}
[[Image:nginx.gif|frame]]
+
== Introduction ==
== What is nginx ==
+
=== What is ACPI? ===
 +
"In computing, the Advanced Configuration and Power Interface (ACPI) specification provides an open standard for device configuration and power management by the operating system." ([http://en.wikipedia.org/wiki/Advanced_Configuration_and_Power_Interface Wikipedia])
  
nginx (pronounced "engin-x") is a Web and reverse proxy server for HTTP, SMTP, POP3 and IMAP protocols. It focuses on high concurrency, performance and low memory usage. Nginx quickly delivers static content with efficient use of system resources, also dynamic content is delivered on a network using FastCGI, SCGI handlers for scripts, uWSGI application servers or Phusion Passenger module (atm broken in [http://funtoo.org funtoo]), further more it can serve a very capable software load balancer. It uses an asynchronos event-driven approach to handle requests which provides more predictable performance under load, in contrast to the Apache HTTP server model, that uses a threaded or process-oriented approach to handling request. Nginx is licensed under a BSD-like license and it runs on Unix, Linux, BSD variants, Mac OS X, Solaris, AIX and Microsoft Windows.
+
=== What is acpid? ===
 +
"ACPID is a completely flexible, totally extensible daemon for delivering ACPI events. It listens on a file (''<code>/proc/acpi/event</code>'') and when an event occurs, executes programs to handle the event. The programs it executes are configured through a set of configuration files, which can be dropped into place by packages or by the admin." ([http://acpid.sourceforge.net/ acpid Sourceforge])
  
== Installation ==
+
== Preparing to install ==
 +
=== Kernel configuration ===
 +
Before we are ready to emerge acpid, it is a good idea to modify a few things in the kernel. If you have not modified your kernel before, you may want to check out the following page on configuring a kernel manually (page to be added..).
  
=== USE flags ===
+
{{kernelop|title=Power management and ACPI options|desc=
 +
[*] ACPI (Advanced Configuration and Power Interface) Support
 +
}}
  
Before you can install nginx, there are the following USE-flags available, these can be set by ''/etc/portage/package.use'' or ''/etc/portage/package.use/nginx'', depending on your setup of package.use.
+
==== Optional: Other ACPI features ====
 +
Below are the locations and short descriptions of the function of different ACPI options in the kernel. In the majority of cases, you do not have to alter any of these to have a functional ACPI system.  
  
* aio - Enables file AIO support
+
* '''AC Adapter'''
* debug - Enables extra debug codepaths, like asserts and extra output.
+
{{kernelop|title=Power management and ACPI options --->|desc=
* http - Enable http serving
+
ACPI (Advanced Configuration and Power Interface) Support --->
* http-cache - Enables caching for http files
+
      < > AC Adapter
* ipv6 - Enables IPv6 support
+
}}
* libatomic - Use libatomic instead of buildtin atomic operations
+
* pcre - Enables support for Perl Compatible Regular Expressions
+
* ssl - Adds support for Secure Socket Layer connections
+
* vim-syntax - Pulls in related vim syntax scripts
+
  
Further more you can set the nginx modules you like to use in ''/etc/make.conf'' in the NGINX_MODULES_HTTP variable as NGINX_MODULES_HTTP="variables".
+
{{fancynote| If you have a system that can switch between being plugged into AC and using a battery (i.e. a laptop), you should compile this option into your kernel.}}
  
* access
+
* '''Battery'''
* addition
+
{{kernelop
* auth_basic
+
|Power management and ACPI options --->|<pre>
* autoindex
+
ACPI (Advanced Configuration and Power Interface) Support --->
* browser
+
      < > Battery
* cache_purge
+
</pre>}}
* charset
+
{{fancynote| As its name would suggest, this option adds or removes support for the battery. More specifically, through /proc/acpi/battery. If you have a laptop or other mobile system, you should probably compile this into your kernel.}}
* dav
+
* degradation
+
* empty_gif
+
* ey_balancer
+
* fastcgi
+
* flv
+
* geo
+
* geoip
+
* gzip
+
* gzip_static
+
* headers_more
+
* image_filter
+
* limit_req
+
* limit_zone
+
* map
+
* memcached
+
* perl
+
* proxy
+
* push
+
* random_index
+
* realip
+
* referer
+
* rewrite
+
* scgi
+
* secure_link
+
* slowfs_cache
+
* split_clients
+
* ssi
+
* stub_status
+
* sub
+
* upload
+
* upstream_ip_hash
+
* userid
+
* uwsgi
+
* xslt
+
  
and the following mail modules as NGINX_MODULES_MAIL in '/etc/make.conf':
+
* '''Button'''
 +
{{kernelop|title=Power management and ACPI options|desc=
 +
ACPI (Advanced Configuration and Power Interface) Support --->
 +
      < > Button
 +
}}
 +
{{fancynote| This driver handles power, sleep, and other buttons. This driver is recommended because it is necessary for software controlled power-off.}}
  
* imap
+
* '''Video'''
* pop3
+
{{kernelop|title=Power management and ACPI options|desc=
* smtp
+
ACPI (Advanced Configuration and Power Interface) Support --->
 +
      < > Video
 +
}}
 +
{{fancynote| Implements ACPI extensions for integrated graphics devices. Also adds support for setting up a video output. }}
  
=== USE Expanded flags ===
+
* '''Fan'''
 +
{{kernelop|title=Power management and ACPI options|desc=
 +
ACPI (Advanced Configuration and Power Interface) Support --->
 +
      < > Fan
 +
}}
  
nginx USE-flags go into ''/etc/portage/package.use'' or ''/etc/portage/package.use/nginx'', while the HTTP and MAIL modules go as NGINX_MODULES_HTTP or NGINX_MODULES_MAIL are stored in /etc/make.conf. And as you wouldn't server only static html files, but most commonly also php files/scripts you should also install php with fpm enabled and xcache for caching the content, what makes your nginx setup way faster. For xcache you need to set PHP_TARGETS="php5-3" in '/etc/make.conf'.
+
{{fancynote| Allows user-controlled applications to control fan speeds and access status of fans. }}
  
Example:
+
* '''Dock'''
<pre>
+
{{kernelop|title=Power management and ACPI options|desc=
echo "www-servers/nginx USE-FLAG-List" >> /etc/portage/package.use/nginx
+
ACPI (Advanced Configuration and Power Interface) Support --->
</pre>
+
      [ ] Dock
 +
}}
 +
{{fancynote| Builds support in the kernel for docking stations like the Dell Module Bay and the IBM Ultrabay. }}
  
=== Emerging nginx ===
+
* '''Processor'''
 +
{{kernelop|title=Power management and ACPI options|desc=
 +
ACPI (Advanced Configuration and Power Interface) Support --->
 +
      < > Processor
 +
}}
 +
{{fancynote| Helps save power while processor is idling and is required by several cpufreq drivers.}}
  
Now you are ready to install nginx with php and xcache support:
+
* '''Processor Aggregator'''
<pre>
+
{{kernelop|title=Power management and ACPI options|desc=
emerge -avt nginx php xcache
+
ACPI (Advanced Configuration and Power Interface) Support --->
</pre>
+
      < > Processor Aggregator
so now just check your useflags and press enter to start emerge.
+
}}
  
== Configuring ==
+
{{fancynote| Allows the host system to practice logical processor idling (a way to reduce power consumption)}}
  
All configuration is done in ''/etc/nginx'' with ''nginx.conf'' as the main configuration file and all virtual hosts in ''/etc/nginx/sites/available'' while you have to symlink ''/etc/nginx/sites-available/{VHOST}'' to ''/etc/nginx/sites-enabled/{VHOST}'' to activate them. An example config for such a {VHOST} looks like that:
+
* '''Thermal Zone'''
 
+
{{kernelop|title=Power management and ACPI options|desc=
<pre>
+
ACPI (Advanced Configuration and Power Interface) Support --->
server {
+
      < > Thermal Zone
    listen          80;
+
}}
    server_name    www.example.com;
+
{{fancynote| Enables support for ACPI thermal zones. It is encouraged to enable this option, as your system may be damaged without it. }}
 
+
    access_log      /var/log/nginx/www.example.com.access_log main;
+
    error_log      /var/log/nginx/www.example.com.error_log info;
+
 
+
    root /var/www/www.example.com/htdocs;
+
}
+
</pre>
+
 
+
The ''nginx.conf'' and ''sites-available/localhost'' file is well commented. Customize it to your needs. Make sure you set the listen option correctly. By default, the listen option is set to listen on the loopback interface. If you leave this unchanged other computers on the network will not be able to connect to the server.
+
 
+
== Configuring PHP FPM ==
+
 
+
As we already installed php with fpm support above we just need to adjust the following settings in ''/etc/php/fpm-php5.3/php-fpm.conf''. You should enable the following settings:
+
 
+
<pre>
+
user = nginx
+
group = nginx
+
pm.start_servers = 20
+
</pre>
+
 
+
The other options should all be very well documented, so make it fit your needs.
+
 
+
== Configuring xcache ==
+
 
+
For setting xcache just edit ''/etc/php/fpm-php5.3/ext-active/xcache''
+
 
+
<pre>
+
zend_extension=/usr/lib64/php5.3/lib/extensions/no-debug-zts-20090626/          xcache.so                                                                 
+
  2 xcache.admin.enable_auth="On"
+
  3 xcache.admin.user="admin"
+
  4 xcache.admin.pass=""
+
  5 xcache.cacher="On"
+
  6 xcache.size="64M"
+
  7 xcache.count="9"
+
  8 xcache.slots="8k"
+
  9 xcache.ttl="0"
+
10 xcache.gc_interval="0"
+
11 xcache.var_size="8M"
+
12 xcache.var_count="1"
+
13 xcache.var_slots="8K"
+
14 xcache.var_ttl="0"
+
15 xcache.var_maxttl="0"
+
16 xcache.var_gc_interval="600"
+
17 xcache.readonly_protection="Off"
+
18 xcache.mmap_path="/dev/zero"
+
19 xcache.coverager="On"
+
20 xcache.coveragedump_directory="/tmp/coverager"
+
21 xcache.optimizer="On"
+
</pre>
+
 
+
it might look like that for you, feel free to change the settings, and if you want to be able to log in into the admin interface set the ''xcache.admin.pass'' as a md5 encrypted password you can find it out with:
+
 
+
<pre>
+
php -a
+
php> echo md5(PASSWORD);
+
</pre>
+
 
+
and copy the admin interface to your vhost:
+
 
+
<pre>
+
cp /usr/share/php/xcache/admin -a /var/www/{VHOST}/htdocs/xcache-admin
+
</pre>
+
 
+
== Starting the service ==
+
 
+
Now start the services:
+
 
+
<pre>
+
/etc/init.d/php-fpm start
+
/etc/init.d/nginx start
+
</pre>
+
 
+
and make them default:
+
 
+
<pre>
+
rc-update add php-fpm default
+
rc-update add nginx default
+
</pre>
+
  
== See also ==
+
== Installing acpid ==
 +
=== Emerging ===
 +
After configuring the kernel power management options, we are ready to install {{Package|sys-power/acpid}}. To install acpid, run the following command:
 +
<console>
 +
###i## emerge acpid
 +
</console>
  
== External links ==
+
=== Adding to rc ===
 +
After you have finished emerging acpid, you may want to add it to the list of rc services to be started with your system at boot.
 +
<console>
 +
###i## rc-update add acpid default
 +
* service acpid added to runlevel default
 +
</console>
 +
Then, run the following to start acpid:
 +
<console>
 +
###i## rc
 +
* starting acpid ...
 +
</console>
 +
[[Category:System]]
 +
[[Category:First Steps]]
 
{{EbuildFooter}}
 
{{EbuildFooter}}

Latest revision as of 05:22, 25 March 2014

Sourced from
Gentoo Portage Tree -> sys-power/acpid

ACPI Daemon

Daemon for Advanced Configuration and Power Interface

Introduction

What is ACPI?

"In computing, the Advanced Configuration and Power Interface (ACPI) specification provides an open standard for device configuration and power management by the operating system." (Wikipedia)

What is acpid?

"ACPID is a completely flexible, totally extensible daemon for delivering ACPI events. It listens on a file (/proc/acpi/event) and when an event occurs, executes programs to handle the event. The programs it executes are configured through a set of configuration files, which can be dropped into place by packages or by the admin." (acpid Sourceforge)

Preparing to install

Kernel configuration

Before we are ready to emerge acpid, it is a good idea to modify a few things in the kernel. If you have not modified your kernel before, you may want to check out the following page on configuring a kernel manually (page to be added..).

Under Power management and ACPI options:

[*] ACPI (Advanced Configuration and Power Interface) Support

Optional: Other ACPI features

Below are the locations and short descriptions of the function of different ACPI options in the kernel. In the majority of cases, you do not have to alter any of these to have a functional ACPI system.

  • AC Adapter

Under Power management and ACPI options --->:

ACPI (Advanced Configuration and Power Interface) Support --->
      < > AC Adapter
Note: If you have a system that can switch between being plugged into AC and using a battery (i.e. a laptop), you should compile this option into your kernel.
  • Battery

Note: As its name would suggest, this option adds or removes support for the battery. More specifically, through /proc/acpi/battery. If you have a laptop or other mobile system, you should probably compile this into your kernel.
  • Button

Under Power management and ACPI options:

ACPI (Advanced Configuration and Power Interface) Support --->
      < > Button
Note: This driver handles power, sleep, and other buttons. This driver is recommended because it is necessary for software controlled power-off.
  • Video

Under Power management and ACPI options:

ACPI (Advanced Configuration and Power Interface) Support --->
      < > Video
Note: Implements ACPI extensions for integrated graphics devices. Also adds support for setting up a video output.
  • Fan

Under Power management and ACPI options:

ACPI (Advanced Configuration and Power Interface) Support --->
      < > Fan
Note: Allows user-controlled applications to control fan speeds and access status of fans.
  • Dock

Under Power management and ACPI options:

ACPI (Advanced Configuration and Power Interface) Support --->
      [ ] Dock
Note: Builds support in the kernel for docking stations like the Dell Module Bay and the IBM Ultrabay.
  • Processor

Under Power management and ACPI options:

ACPI (Advanced Configuration and Power Interface) Support --->
      < > Processor
Note: Helps save power while processor is idling and is required by several cpufreq drivers.
  • Processor Aggregator

Under Power management and ACPI options:

ACPI (Advanced Configuration and Power Interface) Support --->
      < > Processor Aggregator
Note: Allows the host system to practice logical processor idling (a way to reduce power consumption)
  • Thermal Zone

Under Power management and ACPI options:

ACPI (Advanced Configuration and Power Interface) Support --->
      < > Thermal Zone
Note: Enables support for ACPI thermal zones. It is encouraged to enable this option, as your system may be damaged without it.

Installing acpid

Emerging

After configuring the kernel power management options, we are ready to install sys-power/acpid. To install acpid, run the following command:

# emerge acpid

Adding to rc

After you have finished emerging acpid, you may want to add it to the list of rc services to be started with your system at boot.

# rc-update add acpid default
 * service acpid added to runlevel default

Then, run the following to start acpid:

# rc
 * starting acpid ...