Nginx ssl – SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line
I am trying to enable ssl on a server using a certificate from 123-reg but I keep getting this error: nginx: [emerg] SSL_CTX_use_certificate_chain_file(“/opt/nginx/conf/cleantechlms.crt”) failed (SSL: error:0906D06C:PEM routines:PEM_read_bio:no start line error:140DC009:SSL routines:SSL_CTX_use_certificate_chain_file:PEM lib) This is my nginx config: server { listen 443; server_name a-fake-url.com; root /file/path/public; passenger_enabled on; ssl on; ssl_certificate /opt/nginx/conf/cleantechlms.crt; ssl_certificate_key /opt/nginx/conf/cleantechlms.key; } I have tried setting my crt and key to full file permissions but there is no difference. My crt file is [...]
Continue Reading »What is the best nginx compression gzip level?
I’m using nginx reverse proxy cache with gzip enabled. However, I got some problems from android applications http requests to my rails json web service. It seems when I turn off reverse proxy cache, it works ok because the response header comes without gzip. Therefore, I think the problem caused from gzip. What is the most appropriate level of gzip compression? gzip on; gzip_http_version 1.0; gzip_vary on; gzip_comp_level 6; gzip_proxied any; gzip_types text/plain text/css text/javascript [...]
Continue Reading »Nginx Upload Module with Upload Progress Module
I´m trying to setup a File Upload Server with nginx. My nginx config: worker_processes 1;events { worker_connections 1024; }http { include mime.types; default_type application/octet-stream; upload_progress proxied 1m; sendfile on; keepalive_timeout 65;server { listen 80; server_name localhost;client_max_body_size 5000M; #charset koi8-r; #access_log logs/host.access.log main; location / { root html; index index.html index.htm; } location /progress { report_uploads proxied; } location /upload { # Pass altered request body to this location upload_pass @after_upload; # Store files to this [...]
Continue Reading »nginx webdav server with auth request
My nginx.conf: location ~ ^/api/(.*)$ { alias /home/username/apidav/$remote_user/$1; client_body_temp_path /var/www/path/; client_max_body_size 50m; dav_methods PUT DELETE MKCOL;# COPY MOVE; create_full_put_path on; dav_access user:rw group:rw all:r; dav_ext_methods PROPFIND OPTIONS; auth_request /api_auth; }location /api_auth { internal; proxy_pass http://www.domain.ru/accounts/api_auth/; proxy_pass_request_body off; proxy_set_header Content-Length “”; proxy_set_header X-Original-URI $request_uri; } curl -T test.txt ‘http://gert:passwd@www.domain.ru/api/’ curl: (56) Recv failure: Connection reset by peer? Why? tail -f /var/log/nginx/error.log 2012/11/16 17:53:42 [alert] 30060#0: worker process 8374 exited on signal 11 Tail debug log, after [...]
Continue Reading »How to detect ssl in shared 80 / 443 ssl nginx server config?
When nginx server is configured this way: server { listen 80; listen 443 ssl; server_name www.example.org; … } how can be detected that the request came via HTTP or HTTPS? (E.g. $http_port is unusable, because the port is not specified explicitly, therefore it’s empty) Asked by mykhal http://nginx.org/en/docs/http/ngx_http_core_module.html#variables $https — “on” if connection operates in SSL mode, or an empty string otherwise $scheme — request scheme, “http” or “https” Answered by VBart Check more discussion [...]
Continue Reading »HTTPS variable in $_SERVER using nginx as reverse proxy
I’m using nginx as a reverse proxy in front of an apache with mod_php. My site is on https, and it would require the variable $_SERVER['HTTPS'] to be set ‘on’ to assemble some of the links correctly. My site is on drupal, so it is not an option to fix the code and check an other variable when deciding if the site runs under https. Is there a way to fix the issue only with [...]
Continue Reading »How can I lock a directory in debian server installed with ngix?
I tried so many methods and get stick hours with this. I edit /etc/nginx/nginx.conf and write these lines. location /home/user/domains/example.com/public_html/lockfolder/ { auth_basic “Restricted”; auth_basic_user_file /home/user/domains/example.com/.htpasswd; } and I use crypt(3) encryption to make password with the command mkpasswd. Then I did with the given procedure user:encryptedpasswd in .htpasswd. But things does not work as said. Let me know if anyone know how I can exactly make configure for my purpose! I also reload my nginx [...]
Continue Reading »Redirect loop with rewrite rule in Nginx
I have a simple static web site on Nginx, and I’m trying to implement a redirect from mysite.com/index.html to mysite.com, so it’s more search engine friendly. But I get a redirect loop. I wrote this rule: location = /index.html { rewrite ^ http://mysite.com permanent; } Doing some tests, I noticed that if I redirect to the 404 page, everything is fine: rewrite ^ http://mysite.com/404.html permanent; This is the full configuration file: server { listen 80; [...]
Continue Reading »Reverse Proxy – Remove Subdirectory
In the near future I’m going to have 3 nginx servers. One is a reverse proxy for SSL for the two others. So, for example, I go to: https://www.mysitename.com/site1 The two other servers in this example are site1 and site2. I installed the SSL certificate on the proxy and I want to use a reverse proxy (SSL not required since all 3 are on an internal network).For testing purposes I’m having nginx listen on 443 [...]
Continue Reading »Error 404 when using $limit_rate in nginx
I have this configuration running on nginx root@homer:/home/admin# cat /etc/nginx/sites-enabled/example.com server { listen 80; server_name www.example.com example.com; access_log /var/www/example.com/logs/access.log; error_log /var/www/example.com/logs/error.log;## Only allow these request methods (do not accept DELETE, SEARCH and others.. ## if ($request_method !~ ^(GET|HEAD|POST)$ ) {return 444; }location / { root /var/www/example.com/public_html; index index.html index.htm index.php; }location ~ \.php$ { include /etc/nginx/fastcgi_params; if ($uri !~ “^/upload/”) {fastcgi_pass 127.0.0.1:9000; } fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/example.com/public_html$fastcgi_script_name; }# Prevent (deny) Access to Hidden Files [...]
Continue Reading »


