Nginx Commands
Start Nginx nginx Stop Nginx nginx -s stop Reload Nginx nginx -s reload Test Nginx configuration nginx -t See Nginx
Start Nginx nginx Stop Nginx nginx -s stop Reload Nginx nginx -s reload Test Nginx configuration nginx -t See Nginx
Install Requirements CentOS/RHEL/Fedora Ubuntu/Debian Create nginx user Downoad and insta Nginx You can download latest version of Nginx source code from https://nginx.org/en/download.html To install version 1.19.2, run Test Nginx To start nginx run Configuration file is at Enable rtmp stream to configure nginx-rtmp module, see https://github.com/arut/nginx-rtmp-module See Nginx
Nginx Proxy Manager is Docker based GUI for managing Nginx reverse proxy. It support LetsEncrypt free SSL. https://nginxproxymanager.com Nginx Proxy Manager Certificate Key is not valid Install Custom SSL on Nginx Proxy Manager To install, create a folder mkdir nginx-proxy-manager cd nginx-proxy-manager Creaye docker-compose.yaml file vi docker-compose.yaml add following content version: “3” services: app: image: … Read more
When you develop a web site, you will need it password protected so others won’t see or you don’t want google to index the web pages while you are working on it. To password protect a web site in nginx, see Nginx Password Protect a website If you password protect a web site and try … Read more
To enable CORS in nginx, add the following inside web sites server config. Restart nginx See CORS
To list modules compiled with nginx, you can run nginx -V nginx -V This print nginx version along with configuration used to compile nginx. If you want just the list of modules, you can use following command nginx -V 2>&1 | tr — – ‘\n’ | grep _module Example See Nginx
If you have a static website build using plain html files, your url will look like https://yourdomain/page.html. This .html extension is useful for the files when it is on your local computer, it help computer to associate the file with specific application, say your HTML editor. But on a web server this .html extension serve … Read more
To show the full URL in the nginx access log, add the following If you are behind a reverse proxy, replace $remote_addr with $http_x_forwarded_for See Nginx
Logrotate by default rotate logs with numbers like following You can configure how many logs to keep and how to rotate lots by editing logrotate configuration file for nginx rotate 14 – this tells logrotate to keep logs for 14 days. If you need to rotate logs by date, add Example See Logrotate
To enable SSL for stream, you can use nginx reverse proxy. In this case, i have a stream available on http://my-domain.com:8000/index.html?sid=1 I want to make it available using SSL at https://my-domain.com:9000/index.html?sid=1 The port will need to be differnt as you can’t run both HTTP and HTTPS on same port. So i used Port 8000 here. … Read more
To auto start Nginx on Windows, download http://nssm.cc/download Extract the file, you will find “nssm.exe” file for 32 and 64 bit windows. Copy the file for your Windows version to a folder like C:\utils\nssm.exe Start a command promt as user Administrator, then to go the folder where nssm.exe is, then run .\nssm.exe install “Nginx”” In … Read more
On a Nginx server, when accessing a long url, i get error HTTP 414 Request-URI Too Large To fix the error, edit vi /etc/nginx/nginx.conf inside “http” section, find large_client_header_buffers Replace the line with large_client_header_buffers 4 32k; If your URL is very large, you may need to increase the 32k to higher or reduce the url … Read more