Difference between pages "Form:Person" and "Package:Nginx"

From Funtoo
(Difference between pages)
Jump to: navigation, search
(removed Maintained Ebuild, moving to package pages instead of user pages.)
 
m (Daniel Robbins moved page Nginx to Package:Nginx without leaving a redirect)
 
Line 1: Line 1:
<noinclude>
+
__TOC__
This is the 'Person' form.
+
To add a page with this form, enter the page name below;
+
if a page with that name already exists, you will be sent to a form to edit that page.
+
  
{{#forminput:Person}}
+
== What is nginx ==
  
</noinclude><includeonly>
+
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. [[Image:nginx.gif|frame]]
  
 +
== Installation ==
  
== Your Funtoo Information ==
+
=== USE flags ===
__NOTITLE__
+
'''This form allows you to enter your personal information, so that you have an official presence in the Funtoo Universe.'''
+
  
{{{for template|Person}}}
+
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.
=== Your Name, Email, etc. ===
+
  
'''Please enter your full name:'''
+
* aio - Enables file AIO support
 +
* debug - Enables extra debug codepaths, like asserts and extra output.
 +
* http - Enable http serving
 +
* http-cache - Enables caching for http files
 +
* 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
  
{{{field|Full name|required}}}
+
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".
  
Email: {{{field|Email|required}}}
+
* access
IRC Nick: {{{field|Nick}}}
+
* addition
 +
* auth_basic
 +
* autoindex
 +
* browser
 +
* cache_purge
 +
* charset
 +
* 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
  
=== Geographic Location ===
+
and the following mail modules as NGINX_MODULES_MAIL in '/etc/make.conf':
  
Please enter your geographic location. The following form can be used to look up the geographic coordinates for your city.
+
* imap
 +
* pop3
 +
* smtp
  
{{{
+
=== USE Expanded flags ===
field
+
| Geoloc
+
| input type=googlemaps
+
| height=300
+
| width=100%
+
| autozoom=off
+
| zoom=2
+
}}}
+
  
=== Location Name ===
+
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'.
  
Now, please enter your location name, in ''City, State/Province, Country'' format. Please use full country names such as "United States of America."
+
Example:
 +
<pre>
 +
echo "www-servers/nginx USE-FLAG-List" >> /etc/portage/package.use/nginx
 +
</pre>
  
'''Location name'''
+
=== Emerging nginx ===
{{{field|Location name|required|list}}}
+
  
=== Funtoo Roles ===
+
Now you are ready to install nginx with php and xcache support:
 +
<pre>
 +
emerge -avt nginx php xcache
 +
</pre>
 +
so now just check your useflags and press enter to start emerge.
  
Below, you can define your role in the Funtoo Linux Universe. Are you a user, contributor or developer? You can also enter a role description as well as beginning and end dates, which are useful if your role has changed over time. A role with no end date specified indicates an active role.
+
== Configuring ==
  
'''Click "Add Role" to add a role: '''
+
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:
  
{{{field|Roles|holds template}}}
+
<pre>
 +
server {
 +
    listen          80;
 +
    server_name    www.example.com;
  
=== Blogs ===
+
    access_log      /var/log/nginx/www.example.com.access_log main;
 +
    error_log      /var/log/nginx/www.example.com.error_log info;
  
This feature, not yet enabled, will allow you to manage your blog syndication from your user page.
+
    root /var/www/www.example.com/htdocs;
 +
}
 +
</pre>
  
{{{field|Blogs|holds template}}}
+
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.
  
{{{end template}}}
+
== Configuring PHP FPM ==
  
{{{for template|Role|multiple|add button text=Add Role|embed in field=Person[Roles]}}}
+
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:
'''Role type:''' {{{field|Role type|mandatory|input type=dropdown}}}
+
'''Role desc/special powers:''' {{{field|Role desc|mandatory}}}
+
'''Start date:''' {{{field|Start date|input type=datepicker|date format=d M yy}}}
+
'''End date:''' {{{field|End date|input type=datepicker|date format=d M yy}}}
+
{{{end template}}}
+
  
{{{for template|Blog|multiple|add button text=Add blog|embed in field=Person[Blogs]}}}
+
<pre>
'''Name:''' {{{field|Name|mandatory}}}
+
user = nginx
'''URL:''' {{{field|URL|mandatory}}}
+
group = nginx
'''Syndicate on:''' {{{field|Syndicate||list|input type=checkboxes|values from category=Blog Syndication}}}
+
pm.start_servers = 20
{{{end template}}}
+
</pre>
  
'''Your personal wiki text''' -- this is where you can enter free-form information about yourself, using MediaWiki syntax. You can also edit this via the "Edit" button after you save your page.
+
The other options should all be very well documented, so make it fit your needs.
  
{{{standard input|free text|rows=20}}}
+
== Configuring xcache ==
  
{{{standard input|summary}}}
+
For setting xcache just edit ''/etc/php/fpm-php5.3/ext-active/xcache''
  
{{{standard input|minor edit}}} {{{standard input|watch}}}
+
<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>
  
{{{standard input|save}}} {{{standard input|preview}}} {{{standard input|changes}}} {{{standard input|cancel}}}
+
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:
</includeonly>
+
 
 +
<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 ==
 +
 
 +
== External links ==
 +
 
 +
[[Category:Featured]]

Revision as of 06:54, 24 March 2014

Contents


What is nginx

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 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.
Nginx.gif

Installation

USE flags

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.

  • aio - Enables file AIO support
  • debug - Enables extra debug codepaths, like asserts and extra output.
  • http - Enable http serving
  • http-cache - Enables caching for http files
  • 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".

  • access
  • addition
  • auth_basic
  • autoindex
  • browser
  • cache_purge
  • charset
  • 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':

  • imap
  • pop3
  • smtp

USE Expanded flags

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'.

Example:

echo "www-servers/nginx USE-FLAG-List" >> /etc/portage/package.use/nginx

Emerging nginx

Now you are ready to install nginx with php and xcache support:

emerge -avt nginx php xcache

so now just check your useflags and press enter to start emerge.

Configuring

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:

server {
    listen          80;
    server_name     www.example.com;

    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;
}

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:

user = nginx
group = nginx
pm.start_servers = 20

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

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"

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:

php -a
php> echo md5(PASSWORD);

and copy the admin interface to your vhost:

cp /usr/share/php/xcache/admin -a /var/www/{VHOST}/htdocs/xcache-admin

Starting the service

Now start the services:

/etc/init.d/php-fpm start
/etc/init.d/nginx start

and make them default:

rc-update add php-fpm default
rc-update add nginx default

See also

External links