Illustrieren: Wenn du nginx bereits installiert hast, musst du ein Modul hinzufügen, das noch nicht kompiliert und installiert wurde – wie machst du das?
Konkret: Hier ist ein Beispiel für die Installation eines Drittanbieter-ngx_http_google_filter_module-Moduls Das Modul für nginx ist, dass du nginx neu kompilieren musst, anstatt .so zu konfigurieren, wie Apache es tut. 1. Laden Sie die Drittanbieter-Erweiterung herunter ngx_http_google_filter_module
# cd /daten/software/ # Git Clone https://github.com/cuber/ngx_http_google_filter_module
2. Prüfe, welche Module installiert sind, wenn du nginx kompilierst und installierst
# nginx -V nginx-Version: nginx/1.8.0 gebaut von GCC 4.4.7 20120313 (Red Hat 4.4.7-11) (GCC) gebaut mit OpenSSL 1.0.1e-fips am 11. Februar 2013 TLS-SNI-Unterstützung aktiviert Argumente konfigurieren: --Präfix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=/data/software/ngx_http_substitutions_filter_module
Man sieht, dass die Kompilierung und Installation --präfix =/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module verwendet --add-module=/data/software/ngx_http_substitutions_filter_module diese Parameter. --add-module=/data/software/ngx_http_substitutions_filter_module wurde hinzugefügt, als du ngx_http_substitutions_filter_module Modul in der vorherigen Kompilierung hinzugefügt hast
3. Fügen Sie das zu installierende Modul hinzu und kompilieren Sie es erneut, z. B. fügen Sie –add-module=/data/software/ngx_http_google_filter_module hier hinzu
# ./configure --Präfix=/usr/local/nginx --with-http_ssl_module --with-http_sub_module --with-http_gzip_static_module --with-http_stub_status_module --add-module=/data/software/ngx_http_substitutions_filter_module --add-module=/data/software/ngx_http_google_filter_module # make // Keine Installation machen, sonst wird es wirklich überschrieben
4. Ersetzen Sie das nginx-Binärsystem:
# cp /usr/local/nginx/sbin/nginx /usr/local/nginx/sbin/nginx.bak
# cp ./objs/nginx /usr/local/nginx/sbin/
(Hinweis: Beim Ausführen dieses Satzes kann ein Fehler auftreten, cp: kann keine reguläre Datei erstellen '/service/nginx-1.10.2/sbin/nginx': Textdatei ist beschäftigt, weil die nginx-Datei noch verwendet wird, und beim erneuten Hinzufügen des Moduls ist es am besten, nginx zuerst zu stoppen!! )
|