Qnap [ QNginx + PHP-FPM ] [ 1.12.2 ] Web Server and more [embedded]

QoolBox

Représentant QNAP
2 Janvier 2014
10 559
163
153
50
France
www.qnap.com
logo-left-nginx.png


Source : http://nginx.org/

x86 Version :http://www.positiv-it.fr/QNAP/APP/QNginx_1.9.4.0_x86.qpkg.zip (PHP-FPM 5.6.12 embedded)

x86 Version :http://www.positiv-it.fr/QNAP/APP/QNginx_1.9.9.0_x86.qpkg.zip (PHP-FPM 5.7.02 embedded)
phpconfig : http://www.positiv-it.fr/QNAP/PAGE/phpinfo702nginx.htm

x86 Version :http://www.positiv-it.fr/QNAP/APP/QNginx_1.9.12.0_x86.qpkg.zip (PHP-FPM 7.04 embedded)
phpconfig : http://www.positiv-it.fr/QNAP/PAGE/phpinfo7.04.html

x86 Version :http://www.positiv-it.fr/QNAP/APP/QNginx_1.9.14.0_x86.qpkg.zip (PHP-FPM 7.0.5 embedded)
phpconfig : http://www.positiv-it.fr/QNAP/PAGE/phpinfo7.04.html

x86 Version :http://www.positiv-it.fr/QNAP/APP/QNginx_1.11.5.0_x86.qpkg.zip (PHP-FPM 7.0.12 embedded)
x64 Version :http://www.positiv-it.fr/QNAP/APP/QNginx_1.11.5.0_x86_64.qpkg.zip (PHP-FPM 7.0.12 embedded) [ FW 4.3.x]
phpconfig x64 : http://www.positiv-it.fr/QNAP/PAGE/phpinfo_nginx_x641.11.5.html

x64 Version :http://www.positiv-it.fr/QNAP/APP/QNginx_1.12.2.0_x86_64.qpkg.zip (PHP-FPM 7.1.11 embedded)

Note :

Create a share within QTS called 'html' (must be done before install application)
unzip and install QPKG

default listen on port 89

config files are in /opt/QNginx/etc and /opt/QNginx/etc/nginx

phpinfo() available ( http://ip_of_your_nas:89/test.php )

Sample : http://www.positiv-it.fr/QNAP/PAGE/phpinfo_nginx.htm

About :

nginx [engine x] is an HTTP and reverse proxy server, a mail proxy server, and a generic TCP proxy server, originally written by Igor Sysoev. For a long time, it has been running on many heavily loaded Russian sites including Yandex, Mail.Ru, VK, and Rambler. According to Netcraft, nginx served or proxied 22.61% busiest sites in August 2015. Here are some of the success stories: Netflix, Wordpress.com, FastMail.FM.

The sources and documentation are distributed under the 2-clause BSD-like license.


Basic HTTP server features

Serving static and index files, autoindexing; open file descriptor cache;
Accelerated reverse proxying with caching; load balancing and fault tolerance;
Accelerated support with caching of FastCGI, uwsgi, SCGI, and memcached servers; load balancing and fault tolerance;
Modular architecture. Filters include gzipping, byte ranges, chunked responses, XSLT, SSI, and image transformation filter. Multiple SSI inclusions within a single page can be processed in parallel if they are handled by proxied or FastCGI/uwsgi/SCGI servers;
SSL and TLS SNI support.

Other HTTP server features

Name-based and IP-based virtual servers;
Keep-alive and pipelined connections support;
Flexible configuration;
Reconfiguration and upgrade of an executable without interruption of the client servicing;
Access log formats, buffered log writing, fast log rotation, and syslog logging;
3xx-5xx error codes redirection;
The rewrite module: URI changing using regular expressions;
Executing different functions depending on the client address;
Access control based on client IP address, by password (HTTP Basic authentication) and by the result of subrequest;
Validation of HTTP referer;
The PUT, DELETE, MKCOL, COPY, and MOVE methods;
FLV and MP4 streaming;
Response rate limiting;
Limiting the number of simultaneous connections or requests coming from one address;
Embedded Perl.

Mail proxy server features

User redirection to IMAP or POP3 server using an external HTTP authentication server;
User authentication using an external HTTP authentication server and connection redirection to an internal SMTP server;
Authentication methods:
POP3: USER/PASS, APOP, AUTH LOGIN/PLAIN/CRAM-MD5;
IMAP: LOGIN, AUTH LOGIN/PLAIN/CRAM-MD5;
SMTP: AUTH LOGIN/PLAIN/CRAM-MD5;
SSL support;
STARTTLS and STLS support.

TCP proxy server features

Generic proxying with SSL termination; load balancing and fault tolerance;
 
Merci FX,

j'en ai un peu ch..., ce fut long, un projet d'une semaine (un peu tous les soirs)
sans compter le temps de comprendre comment fonctionne NGinx (et je pense que j'ai pas encore tout compris)

mais j'avoue c'est une bombe ce soft... :geek:
 
Nginx est vraiment super rapide et beaucoup moins lourd qu'Apache et PHP-FPM (que j'utilise ici et sur Cachem) augmente sensiblement les performances brutes.
Franchement, pour héberger un petit blog sur son NAS... c'est une combo efficace.
 
Bonjour (sorry the only french word i know :geek: ),

just installed and the test pages work but i have some questions though.

1. default port is 89 but for all practical purposes, default web site ports are 80. so how do i go about doing that ? will this conflict with qnaps other apps that use the default web share ? :?

2. i tried running wordpress but it didn't work, not sure why.

Code:
http://my qnap lan ip:89/wordpress/

i get this message
Code:
An error occurred.

Sorry, the page you are looking for is currently unavailable.
Please try again later.

If you are the system administrator of this resource then you should check the error log for details.

Faithfully yours, nginx.


3. any tips for securing nginx ? not sure that default will avoid site getting hacked. normally in apache you had htaccess to prevent unrestricted sub directory browsing, and editing of the files. not familiar with nginx :?


other than these things, i know how to operate the wordpress. it's just the initial setup that is hard :? (except the wordpress install process, but unfortunately i can't do it cause i can't access the install process)
 
i am not nginx expert, but you have to modify setting in nginx config file

/opt/QNginx/etc and /opt/QNginx/etc/nginx

before modification nginx must be turned off

sorry i didnt had time to make a web admin for nginx
 
QoolBox a dit:
i am not nginx expert, but you have to modify setting in nginx config file

/opt/QNginx/etc and /opt/QNginx/etc/nginx

before modification nginx must be turned off

thx i'll try hack that :geek:

QoolBox a dit:
sorry i didnt had time to make a web admin for nginx

no problem. i guess most tech savvy users wouldn't need it as they know already what to do to get it working. not gonna add more work for you :geek: hopefully qnap can implement this bridge of sorts...

i just think qnap should eventually make an easier process to switch between apache and nginx without resorting to hacking to make the switch hehe.
 
petite mise à jour au passage

nginx >> 1.9.12
php-fpm >> 7.0.04
openssl >> 1.0.1r
Curl >> 7.47.1

ajout du support libwebp

(Upload en cours)
 
Bonne idée l'interface,

c'est idéal pour ceux qui ne maitrise pas la config manuelle (c'est pas mon cas)

Tu aurai une idée pour éviter de faire une grosse manip comme celle la pour désactiver la redirection du port 80 vers 8080 ou 443 de la web interface du nas
 
Celena-007 a dit:
Tu aurai une idée pour éviter de faire une grosse manip comme celle la pour désactiver la redirection du port 80 vers 8080 ou 443 de la web interface du nas
Pour désactiver la rédirection du port 80 vers 8080 il suffit de permettre l'accès à QTS que en https. Le problème par contre reste pour tout accès en https. Ici il y a une possible solution. Ici d'autre informations peut-être utiles. :D
 
En fait j'ai une solution encore plus simple :D

Je laisse tel quel la config du nas; NginX écoute sur 89 http et 8443 https en multiServeur, sauf que sur mon routeur en externe le 80 est rediriger sur 89, et 433 est rediriger sur 8443 (les deux ver l'IP fixe du nas).

du coup pour l'interface web directement 8080 depuis l’extérieur, en local du fait que routeur a des routes via les noms (plus complexe qu'un simple mappage de port) cela fonctionne aussi :D

Mon routeur : EdgeRouter PoE
Donc en fait je n'est rien dit :D
 
Autre solution :
Dans mon cas (TS-251) j'ai 2 port ethernet;
cette solution consiste a spécifier a nginx d’écouter l'adresse IP d'eth2 et apache l'adresse ip d'eth1
Par défaut ces deux serveur écoute le port 80 sur toutes les interface réseaux disponible; sauf si on leur signale une certaine IP

cependant l'adresse ssl de QTS reste accessible sur les 2 eth sur le port définit

example :
Code:
/mnt/HDA_ROOT/.config/apache/apache.conf:
Ligne 17 => Listen 192.168.0.42:80 (adresse IP eth1)
Attention : si une modification de la configuration est faite via l'interface QTS il faudra refaire la manip manuellement !

Nginx :
Code:
    server {
        listen 192.168.0.27:80; (adresse IP eth2)
        server_name example.com;
    }

    server {
        listen 192.168.0.27:443; (adresse IP eth2)
        server_name example.com;
    }
 
J'aime bien la deuxieme solution Celena, mais le problème reste ouvert si on doit accéder dès l'extérieur. De plus on auras toujours le problème que la porte 443 est déjà utilisée par QTS.

Bien évidemment la première solution marche très bien depuis l'extérieur, mais un peu moins bien depuis ton Lan, mais c'est la solution la plus simple.

En effet, l'idéal serait si on pouvait restreindre QTS à une seule interface IP et pouvoir puis créer un reverse proxy en virtual host. De cette manière, en effet on aurait la porte 443 sur l'autre interface ethernet/IP libre pour Qthttp/Ngix et tous les services qu'on veut en utilisant tjrs un virtual host différent. Il faudrait tester, vérifier si cela serait possible...

Stéphane, qu'est ce que tu en penses? Est-il possible de faire écouter QTS à une seule interface (plus localhost évidemment) ?

Sent from mobile using TapaTalk

Edit: en réfléchissant plus, cela ne résoudrait pas le problème en externe (dehors le réseau local), car on serait obligé de toute manière de spécifier une porte différente de 443, sinon on serait de toute manière redirigé sur le login QTS. (Sauf si on a deux lignes internet séparées, avec deux IP externes).

La seule solution est donc effectivement de changer la porte SSL pour QTS ennutilisant une différente de la 443.
 
j'ai pas testé mais cela doit être possible dans les paramètre Réseau et l'association aux services ...

généralement c'est plus utilisé lorsqu'il y a plusieurs sous réseau.. mais ca devrait sans doute fonctionner
 
giopas a dit:
En effet, l'idéal serait si on pouvait restreindre QTS à une seule interface IP et pouvoir puis créer un reverse proxy en virtual host. De cette manière, en effet on aurait la porte 443 sur l'autre interface ethernet/IP libre pour Qthttp/Ngix et tous les services qu'on veut en utilisant tjrs un virtual host différent. Il faudrait tester, vérifier si cela serait possible..

Bonne réponse et ça fonctionne
Code:
Réseaux -> Association aux services -> Activer l'association des services
Perso j'ai tous laisser cocher en eth1 et tous décocher eth2

en utilisant un virtualhost nginx tu peut renvoyer un 443 vers l'ip d'eth:443 ou autres ports (je part du principe que le routeur renvoit 80 et 443 sur eth2)