Quantcast
Channel: Nginx Forum - How to...
Viewing all articles
Browse latest Browse all 4759

Re: Trailing slash madness

$
0
0
I have it working.

The solution is quite common but hasn't worked previously. Here is the updated conf file:

server {
listen 443;
server_name sub.domain.com;
server_name_in_redirect on;

access_log off;
error_log /var/log/nginx/error.log crit;

ssl on;
ssl_certificate /etc/ssl/cert/cert.crt;
ssl_certificate_key /etc/ssl/cert/cert.key;

ssl_session_timeout 5m;

ssl_protocols TLSv1.1 TLSv1.2;
ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES";
ssl_prefer_server_ciphers on;

rewrite ^([^.]*[^/])$ $1/ permanent;
location / {

proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;

proxy_pass http://192.168.10.202;

proxy_redirect http://192.168.10.202 https://sub.domain.com;
}
}

What's different is I added the line: rewrite ^([^.]*[^/])$ $1/ permanent;

That little bit of text is readily found by searching Google but what isn't clear is where it should go in the file.

It didn't work for me until I placed it immediately ahead of the location {} section.

Viewing all articles
Browse latest Browse all 4759

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>