The Funtoo Linux project has transitioned to "Hobby Mode" and this wiki is now read-only.
Difference between revisions of "Package:Tengine"
Threesixes (talk | contribs) m (more details) |
Threesixes (talk | contribs) m |
||
Line 4: | Line 4: | ||
|Homepage=http://tengine.taobao.org | |Homepage=http://tengine.taobao.org | ||
}} | }} | ||
Tengine is an {{package|www-servers/nginx}} fork. It supports DSO module loading, meaning it can have external modules without the need to compile them in. | Tengine is an {{package|www-servers/nginx}} fork. It supports DSO module loading, meaning it can have external modules without the need to compile them in. | ||
===Installation=== | ===Installation=== | ||
Line 18: | Line 18: | ||
==== External Modules ==== | ==== External Modules ==== | ||
If you want to run passenger: | If you want to run passenger: | ||
{{file|name=/etc/portage/make.conf|desc=build the passenger module|body= | {{file|name=/etc/portage/make.conf|desc=build the passenger module|body= | ||
Line 25: | Line 23: | ||
}} | }} | ||
Then | Then, just: | ||
{{console|body=###i## emerge tengine}} | {{console|body=###i## emerge tengine}} | ||
Line 50: | Line 48: | ||
{{c|/etc/tengine/sites-available/localhost}} has site specific configurations. Generally localhost is copied to domain.tld file formats in the {{c|/etc/tengine/sites-available/}} directory. | {{c|/etc/tengine/sites-available/localhost}} has site specific configurations. Generally localhost is copied to domain.tld file formats in the {{c|/etc/tengine/sites-available/}} directory. | ||
===Redirection=== | ===Redirection from HTTP to HTTPS=== | ||
These days, it is usual to have anything on https to protect your users regarding login and privacy where it comes handy to automatically redirect requests from http which are often a result of the browsers autocompletion. To achieve that, we need a server listening on http and redirecting to our main server on https like this : | These days, it is usual to have anything on https to protect your users regarding login and privacy where it comes handy to automatically redirect requests from http which are often a result of the browsers autocompletion. To achieve that, we need a server listening on http and redirecting to our main server on https like this : | ||
Line 62: | Line 60: | ||
}} | }} | ||
===PHP-FPM=== | ===PHP-FPM=== | ||
Tengine does not natively support php, so we delegate that responsibility to [[Package:PHP#Fpm | php-fpm]] | Tengine does not natively support php, so we delegate that responsibility to [[Package:PHP#Fpm | php-fpm]] | ||
Line 79: | Line 68: | ||
index index.php index.cgi index.htm index.html; | index index.php index.cgi index.htm index.html; | ||
location ~ \.php$ { | location ~ \.php$ { | ||
fastcgi_pass 127.0.0.1:9000; | |||
include fastcgi.conf; | include fastcgi.conf; | ||
} | } | ||
Line 88: | Line 76: | ||
=== Passenger === | === Passenger === | ||
To serve with passenger, change the root statement below to point to your rails application's public directory: | |||
To serve with passenger, change the root statement below to point to your application's public directory: | |||
{{file|name=/etc/tengine/sites-available/localhost|desc=passenger configuration|body= | {{file|name=/etc/tengine/sites-available/localhost|desc=passenger configuration|body= | ||
passenger_root /usr/libexec/passenger/locations.ini; | passenger_root /usr/libexec/passenger/locations.ini; | ||
Line 108: | Line 88: | ||
} | } | ||
}} | }} | ||
===Usage=== | ===Usage=== |
Revision as of 08:02, May 21, 2015
Tengine
We welcome improvements to this page. To edit this page, Create a Funtoo account. Then log in and then click here to edit this page. See our editing guidelines to becoming a wiki-editing pro.
Tengine is an www-servers/nginx fork. It supports DSO module loading, meaning it can have external modules without the need to compile them in.
Installation
If you happen to want all modules installed dynamically, you, still, need to install some static modules. Make sure to add this to your /etc/portage/make.conf
file:
/etc/portage/make.conf
- Tengine all-modules build...
TENGINE_SHARED_MODULES_HTTP="access addition autoindex browser charset_filter empty_gif fastcgi flv footer_filter geoip image_filter limit_conn limit_req lua map memcached mp4 random_index referer reqstat rewrite scgi secure_link slice split_clients sub sysguard tfs trim_filter upstream_ip_hash upstream_least_conn upstream_session_sticky user_agent userid_filter uwsgi xslt"
TENGINE_STATIC_MODULES_HTTP="concat dav degradation geo gunzip gzip gzip_static perl proxy realip spdy ssi ssl stub_status upstream-rbtree upstream_check upstream_consistent_hash upstream_keepalive"
...
External Modules
If you want to run passenger:
/etc/portage/make.conf
- build the passenger moduleTENGINE_EXTERNAL_MODULES_HTTP="passenger"
Then, just:
root # emerge tengine
Configuration
Files for configuration are located at /etc/tengine
The major differing point in tengine from nginx is that you have to specifically declare which modules are loaded. Available modules are located at /var/lib/tengine/modules
.
/etc/tengine/tengine.conf
- DSO module statements...
dso {
load ngx_http_charset_filter_module.so;
load ngx_http_fastcgi_module.so;
load ngx_http_rewrite_module.so;
load ngx_http_access_module.so; ## added because you want most likely use allow & deny on certain positions
}
...
Tengine
/etc/tengine/tengine.conf
contains engine specific configurations.
Sites
/etc/tengine/sites-available/localhost
has site specific configurations. Generally localhost is copied to domain.tld file formats in the /etc/tengine/sites-available/
directory.
Redirection from HTTP to HTTPS
These days, it is usual to have anything on https to protect your users regarding login and privacy where it comes handy to automatically redirect requests from http which are often a result of the browsers autocompletion. To achieve that, we need a server listening on http and redirecting to our main server on https like this :
/etc/tengine/sites-available/redir
- redirection from http to httpsserver {
server_name domain.tld;
listen 80;
return 302 https://www.domain.tld$request_uri;
}
PHP-FPM
Tengine does not natively support php, so we delegate that responsibility to php-fpm
/etc/tengine/sites-available/localhost
- fpm tcp/ip configurationserver {
...
index index.php index.cgi index.htm index.html;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
include fastcgi.conf;
}
...
}
Passenger
To serve with passenger, change the root statement below to point to your rails application's public directory:
/etc/tengine/sites-available/localhost
- passenger configurationpassenger_root /usr/libexec/passenger/locations.ini;
passenger_ruby /usr/bin/ruby;
server {
passenger_enabled on;
passenger_app_env development;
root /home/$USER/ror/public;
...
}
Usage
To start the tengine server:
root # rc-update add tengine default root # rc