Open jonyoi opened 6 years ago
Doesn't this only work if you have a separate server
block for SSL and non-SSL though? Otherwise there would be an infinite redirect.
Unfortunately Virtualmin currently only uses a single server
block for both protocols (unlike Apache).
I have recently run into a similiar issue, where we needed to redirect www. to non-www.
Nginx expects something similar to this to deal with this scenario:
server {
server_name www.example.com;
listen 443 ssl http2;
ssl_certificate /etc/ssl/virtualmin/16848264071884359/ssl.cert;
ssl_certificate_key /etc/ssl/virtualmin/16848264071884359/ssl.key;
return 301 $scheme://example.com$request_uri;
}
server {
server_name example.com;
listen 443;
ssl_certificate /etc/ssl/virtualmin/16848264071884359/ssl.cert;
ssl_certificate_key /etc/ssl/virtualmin/16848264071884359/ssl.key;
......
}
The latest version of Virtualmin does support different redirects for HTTP and HTTPS, which you can create in the UI.
I did try and use the UI to create this www.example.com
--> example.com
redirect, but I couldn't figure it out:
The above errors with:
Failed to save redirect : Missing or invalid source URL path
Which makes sense of course, as this form is for a redirect based upon the source path relative to the virtual server domain.
The source URL path should be just /
I have tried this and I still get the Failed to save redirect : Missing or invalid source URL path
error
Are you sure there's not a space at the start or end of the path?
Yes:
Hmm, this is very confusing. Can you check which version of Virtualmin and the Nginx plugin you're running there?
SYSTEM INFORMATION | |
---|---|
OS type and version | Rocky Linux 9.2 |
Webmin version | 2.021 |
Usermin version | 1.861 |
Virtualmin version | 7.7 |
Theme version | 20.21 |
Package updates | All installed packages are up to date |
Webmin module Nginx Webserver | 2.30-1 |
Webmin module Nginx Webserver SSL | 1.19-1 |
We just released Webmin 2.100 - try upgrading and see if that helps.
We're still seeing the same issue with 2.101
:
We're still seeing the same issue with
2.101
:
Webmin .. ? It should be Virtualmin and/or Virtualmin Nginx module.
Although, I agree that the usage is confusing. I will add placeholders for the textfields.
Besides, URL at this website should be like /dir1
.. not domain name ..
Next Virtualmin release will have it displayed more explicitly using placeholders, e.g.:
Not sure, Jamie suggested trying 2.101
I tried with a sub directory too (so https://www.example.com/test) and I get the same error.
Please look at my screenshot above for reference.
This is related to redirecting www.example.com to example.com
So do we not need to use the second option, 'URL at this website'?
So do we not need to use the second option, 'URL at this website'?
No. Here the example that will work for you right now:
However, we have bugs that needs to be fixed before we finally release new Virtualmin and Virtualmin Nginx module.
SYSTEM INFORMATION | |
---|---|
OS type and version | Rocky Linux 9.3 |
Webmin version | 2.105 |
Usermin version | 2.005 |
Virtualmin version | 7.8.2 |
Theme version | 21.09.5 |
Nginx module | 1.20-1 |
Package updates | All installed packages are up to date |
This just results in a redirect loop:
or this:
Nginx really wants two server blocks to handle the www -> non-www redirect:
https://www.nginx.com/resources/wiki/start/topics/tutorials/config_pitfalls/#server-name-if
I am using LEMP stack with Virtualmin which I installed using "--bundle LEMP" while installing virtualmin on a debian9 OS.
When I below settings, The https redirect is not working on any of the domains.
System Settings --> Virtualmin Configurations --> SSL Settings --> Redirect all http to https by default --> yes
However I am able to do the redirect by adding below code in domain.com.conf
server { server_name domain.com www.domain.com; listen ipaddress:80; rewrite ^/(.*) https://domain.com/$1 permanent; }
But I wonder why the inbuilt feature that ships with virtualmin is not working?
Please note I am using Lets' Encrypt SSL.
on other note I wonder what type of Redirect Virtualmin does if that feature is to work? Is it also 301 redirect?
Any help on this would be immensely helpful.
Thanks
UPDATE: I created this thread back in 2018 where I used virtualmin briefly when I was testing it out. I never really used virtualmin to it's extent.
I can't believe this is still an issue after 5 years. I have been receiving notifications about it, so I came here to update this thread and unsubscribe from it, as I can't really figure out how to delete this thread.