I have an nginx reverse proxy set up like this:
/etc/nginx/sites-available/domain.com
server {
listen 80;
listen [::]:80;
root /var/www/html;
index index.html index.htm index.nginx-debian.html;
server_name domain.com www.domain.com;
location / {
proxy_pass http://localhost:8090;
autoindex on;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection 'upgrade';
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
The site is on Apache, which is listening on port 8090.
So, /etc/apache2/ports.conf looks like this:
Listen 8090
<IfModule ssl_module>
Listen 443
</IfModule>
<IfModule mod_gnutls.c>
Listen 443
</IfModule>
It works, but a trailing slash is added. So I can see my website at domain.com//
I’m not sure if it’s nginx or apache causing the trailing extra slash at the end. How can I fix this?
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
Hello,
this would be from the Nginx Configuration for sure, this is a know issues with it. Most probably you’ve added a trailing slash somewhere along the way.
Please check your Nginx configuration file for the domain and make sure there is no trailing slash when doing rewrites such as :
Rewrite ^(.*)$ https://$servername.mydomain.com/$1;
or
server_name domain.com/ www.domain.com/;
Another problematic area might be:
location / {
proxy_pass http://localhost:8090/;
I know you’ve provided us with an example configuration file but please take another look to the exact domain’s file and make sure there are no leftover trailing slashes.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.