Difference between revisions of "Nginx"
(14 intermediate revisions by 2 users not shown) | |||
Line 4: | Line 4: | ||
* Configuration Files: | * Configuration Files: | ||
:<code>[[/etc/nginx/nginx.conf]]</code> | :<code>[[/etc/nginx/nginx.conf]]</code> | ||
− | :<code>/etc/nginx/conf.d/[[default.conf]]</code> | + | :<code>[[/etc/nginx/conf.d/]][[default.conf]]</code> |
− | :<code>/etc/nginx/sites-enabled</code> | + | :<code>[[/etc/nginx/sites-enabled/]]</code> |
+ | :<code>[[/etc/nginx/sites-enabled/default]]</code> | ||
[[Nginx logs]] (See also [[Nginx change log]]) | [[Nginx logs]] (See also [[Nginx change log]]) | ||
Line 18: | Line 19: | ||
apt install [[nginx-light]] | apt install [[nginx-light]] | ||
[[systemctl status nginx]] | [[systemctl status nginx]] | ||
− | [[/var | + | [[/var/www/html/]] |
− | + | <code>[[apt install nginx]]</code> | |
[[Docker Nginx]] https://hub.docker.com/_/nginx | [[Docker Nginx]] https://hub.docker.com/_/nginx | ||
Line 55: | Line 56: | ||
Other features include upgrading executable and configuration without client connections loss,<ref name="Controlling nginx" /> and a module-based architecture with both core<ref name="documentation" /> and third-party module support.<ref name="3rdPartyModules" /> | Other features include upgrading executable and configuration without client connections loss,<ref name="Controlling nginx" /> and a module-based architecture with both core<ref name="documentation" /> and third-party module support.<ref name="3rdPartyModules" /> | ||
− | The paid [[Nginx]] | + | The paid [[Nginx Plus]] product includes additional features such as advanced [[load balancing]] and access to an expanded suite of metrics for performance monitoring.<ref name="Plus metrics" /><ref name="Plus load balancing" /> |
== Linux Nginx Operation on [[systemd]] distributions == | == Linux Nginx Operation on [[systemd]] distributions == | ||
Line 72: | Line 73: | ||
Medium | Medium | ||
− | * Use <code>[[prometheus | + | * Use <code>[[prometheus-nginx-exporter]]</code> to collect Nginx metrics |
+ | * Use [[metricbeat]] to collect metrics, see: <code>[[metricbeat modules list]]</code> | ||
== Related terms == | == Related terms == | ||
* [[NGINX Amplify]] [[SaaS]] | * [[NGINX Amplify]] [[SaaS]] | ||
+ | * [[Subdomain redirection]] | ||
+ | * <code>[[nginx_status]]</code> | ||
+ | * [[F5 Inc]] | ||
+ | * [[Kubernetes]]: [[Ingress-nginx]] | ||
== See also == | == See also == | ||
− | * {{ | + | * {{nginx.conf}} |
* {{nginx}} | * {{nginx}} | ||
− | * {{ | + | * {{web server}} |
− | + | ||
− | + | ||
[[Category:Web]] | [[Category:Web]] |
Latest revision as of 16:20, 16 July 2024
wikipedia:Nginx web server that was written in 2004 as an alternative to popular Apache web server.
- Official documentation: https://nginx.org/en/docs/
- Configuration Files:
/etc/nginx/nginx.conf
/etc/nginx/conf.d/default.conf
/etc/nginx/sites-enabled/
/etc/nginx/sites-enabled/default
Nginx logs (See also Nginx change log)
- Error log file:
/var/log/nginx/error.log
- Access log file:
/var/log/nginx/access.log
- Logrotate:
/etc/logrotate.d/nginx
journalctl -u nginx
journalctl -u nginx | grep emerg
Contents
Installation[edit]
apt install nginx-light systemctl status nginx /var/www/html/
Docker Nginx https://hub.docker.com/_/nginx
Nginx Sample Configurations[edit]
Features[edit]
Nginx can be deployed to serve dynamic HTTP content on the network using FastCGI, SCGI handlers for scripts, WSGI application servers or Phusion Passenger modules, and it can serve as a software load balancer.[1]
Nginx uses an asynchronous event-driven approach, rather than threads, to handle requests.[2] Nginx's modular event-driven architecture can provide more predictable performance under high loads.[3][4]
Nginx default configuration file is nginx.conf
.[5]
HTTP proxy and Web server features[edit]
- Ability to handle more than 10,000 simultaneous connections with a low memory footprint (~2.5 MB per 10k inactive HTTP keep-alive connections)
- Handling of static files, index files and auto-indexing
- Reverse proxy with caching[6] (
proxy_pass
directive) (Do not support proxy [7]) - Load balancing with in-band health checks[8] (
upstream
directive) - TLS/SSL with SNI and OCSP stapling support, via OpenSSL
- FastCGI, SCGI, uWSGI support with caching
- gRPC support since March 2018, version 1.13.10.[9]
- Name- and IP address-based virtual servers
- IPv6-compatible
- WebSockets since 1.3.13,[10][11] including acting as a reverse proxy and do load balancing of WebSocket applications.[12]
- HTTP/1.1 Upgrade (101 Switching Protocols),[13] HTTP/2 protocol support
- URL rewriting and redirection[14][15]
Mail proxy features[edit]
- TLS/SSL support
- STARTTLS support
- SMTP,[16] POP3, and IMAP proxy
- Requires Authentication using an external HTTP server or by an authentication script[17][18]
Other features include upgrading executable and configuration without client connections loss,[19] and a module-based architecture with both core[20] and third-party module support.[21]
The paid Nginx Plus product includes additional features such as advanced load balancing and access to an expanded suite of metrics for performance monitoring.[22][23]
Linux Nginx Operation on systemd distributions[edit]
- Verify/Test Configuration:
nginx -t
- Status:
systemctl status nginx
- Start:
systemctl start nginx
- Stop:
systemctl stop nginx
- Restart:
systemctl restart nginx
(See also:nginx -t
)
Activities[edit]
- Track Application Response time in Nginx
- Enable status page in Nginx to get information about active connections and other parameters: https://easyengine.io/tutorials/nginx/status-page/ and test it:
curl http://127.0.0.1/nginx_status
- Read Nginx Change log
- Configure HTTP to HTTPs redirection with Nginx
- Review SSL nginx configuration
Medium
- Use
prometheus-nginx-exporter
to collect Nginx metrics - Use metricbeat to collect metrics, see:
metricbeat modules list
Related terms[edit]
See also[edit]
- Nginx:
nginx -t
,nginx.conf
,/etc/nginx/fastcgi.conf
, Nginx Sample Configurations,server
,ssl_certificate
,redirect
,return
,rewrite
,sendfile
,request_uri
,server_name
,listen
,/etc/nginx/snippets/
,/etc/nginx/sites-enabled/default
- Web server: Nginx:
/etc/nginx/nginx.conf
,nginx -t
, Nginx logs, Nginx change log, PHP,php-fpm
, Let's encrypt, Nginx directives, Reverse Proxy, Configure HTTP redirection Nginx, Return,proxy_pass (Reverse proxy)
,ngx_http_rewrite_module
,/etc/nginx/sites-enabled/
,error.log
,access.log
,/nginx status
, AIO - Web servers: Apache, Nginx, Caddy,
Caddyfile
, Lighttpd, Gunicorn, WSGI
Text is available under the Creative Commons Attribution-ShareAlike License; additional terms may apply. By using this site, you agree to the Terms of Use and Privacy Policy.
Source: https://en.wikipedia.org/wiki/Nginx
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedKleinman
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedWelcome
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedaosabook
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedConfiguration
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedBeginner
- ↑ https://docs.nginx.com/nginx/admin-guide/web-server/reverse-proxy/
- ↑ https://serverfault.com/a/298401
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedLoad balancing
- ↑ https://www.nginx.com/blog/nginx-1-13-10-grpc/
- ↑ http://nginx.org/en/docs/http/websocket.html
- ↑ https://nginx.org/en/docs/http/websocket.html
- ↑ https://www.nginx.com/blog/websocket-nginx/
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs named101 Switching Protocols
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedmdoc-intro
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedmdoc
- ↑ https://docs.nginx.com/nginx/admin-guide/mail-proxy/mail-proxy/
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedAuthentication
- ↑ https://docs.nginx.com/nginx/admin-guide/mail-proxy/mail-proxy/#mail_auth
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedControlling nginx
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs nameddocumentation
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs named3rdPartyModules
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedPlus metrics
- ↑ Cite error: Invalid
<ref>
tag; no text was provided for refs namedPlus load balancing
Advertising: