Nginx file upload error

When uploading a file on a PHP Application running under an Nginx web server, I get the following error 2021/08/14 12:32:04 [crit] 1722576#1722576: *42823 open() “/var/lib/nginx/tmp/client_body/0000000006” failed (13: Permission denied), client: 59.12.21.51, server: team.serverok.in, request: “POST /index.php/ijci/$$$call$$$/wizard/file-upload/file-upload-wizard/upload-file?submissionId=311&stageId=1&fileStage=2&reviewRoundId=&assocType=&assocId= HTTP/2.0”, host: “team.serverok.in”, referrer: “https://team.serverok.in/index.php/ijci/submission/wizard/2?submissionId=311” The error was due to wrong ownership for folder /var/lib/nginx/tmp/client_body/ or one of … Read more

Enable SSL for icecast steam using nginx

On ubuntu server running icecast, when i try enable SSL as per CentovaCast Enable SSL on icecast, i get following error connection/get_ssl_certificate No SSL capability I don’t compile my own icecast installation as it use Ubunu version of icecast, that get updated using apt. Instead of getting icecast serve steam using SSL, i installed Nginx, … Read more

Nginx Hotlink Protection

To block hotlink protection or bandwidth stealing, you can add the following to the server configuration of your website. If you need to allow hotlinks from a specific domain, you can edit the valid_referers line and add the URL. For allowing access without any referral, you can use “none” instead of the domain name. For … Read more

Nginx Proxy Manager Certificate Key is not valid

When adding custom SSL on Nginx Proxy Manager, i get following error. Upload failed: Certificate Key is not valid (Command failed: openssl ec -in /tmp/15dbf072-4022-aee94-0f88e4fb8d86/tmp -check -noout 2>&1 ) I tried upgrading Nginx Proxy Manager to the latest version with the following commands Even after the upgrade, this error persists. I checked logs for the … Read more

How to block .git directory in nginx

When using git version control to deploy application, many forget to secure .git folder. This allows anyone to clone your git repository. If you have any credentials commited to your git version control, then hacker will be able to gain access. To avoid this, it is better plan the git repo in a way you … Read more

Nginx on Windows

You can download nginx for windows from https://nginx.org/en/download.html To download nginx from command line, use following command in PowerShell Invoke-WebRequest -Uri https://nginx.org/download/nginx-1.19.6.zip -OutFile nginx-1.19.6.zip Auto Start Nginx on Windows When using Nginx on Windows, you need to escape paths with \ like following root C:\\sites\\my-site; For SSL, i used listen 443 ssl http2; ssl_certificate C:\\nginx\\ssl\\crt\\dedi.ai-chain.pem; … Read more

Enable Nginx Status Page

Nginx status is provided by http_stub_status module. To verify if your Nginx is installed with this module, run nginx -V 2>&1 | grep -o with-http_stub_status_module If the result shows “with-http_stub_status_module”, you have the module installed. To enbale stats edit nginx configuration file for your web site, add following code location /nginx_status {     stub_status; … Read more

Nginx upstream sent too big header

Plesk Nginx

When I log in to a PrestaShop website, I get an error on a Plesk server. 502 Bad Gateway On checking error login for the site in folder /var/www/vhosts/domain.com/logs/proxy_error_log, I found the following error message proxy_error_log:2020/11/25 19:41:41 [error] 1809#0: *39664 upstream sent too big header while reading response header from upstream, client: 59.92.71.53, server: tulivesi.com, … Read more

Country Blocking with nginx GeoIP on Ubuntu/Debian

On Ubuntu/Debian, install nginx geoip module with apt install geoip-database libgeoip1 libnginx-mod-http-geoip -y Now edit nginx.conf vi /etc/nginx/nginx.conf Find http { Add below geoip_country /usr/share/GeoIP/GeoIP.dat; map $geoip_country_code $my_country_blocker { default no; US yes; AU yes; CA yes; } You can add 2 letter country code and set ye/no as required. To implement GeoIP blocking for … Read more