Can you explain the issue in English?
Hi @kanhu,
Well, I will try to explain.
At the beginning, the situation was like this
- ndd.tld > goes to the admin interface
- www.ndd.tld > goes to the admin interface
- wiki.ndd.tld > goes to a dokuwiki
- rss.ndd.tld > goes to ttrss
I was trying to have something like this
- ndd.tld > goes to wiki.ndd.tld
- www.ndd.tld > goes to wiki.ndd.tld
- wiki.ndd.tld > goes to a dokuwiki
- rss.ndd.tld > goes to ttrss
That is why, I created 2 redirection with redirect_ynh
- ndd.tld > wiki.ndd.tld (1)
- www.ndd.tld > wiki.ndd.tld (2)
The (2) works well whereas (1) makes problem.
- I could not connect to the user interface
- I could not access ttrss and other applications
@scith found out why it was not working. The reason was that ndd.tld was set as the default domain.
That is why, I created a new sub-domain admin.ndd.tld and set it as the default domain. Now, I note that :
- I can access to the user interface
- sso does not work well (not working with nextcloud, dokuwiki; ok with ttrss)
- when I try to look at my mail (user@ndd.tld) with thunderbird, I have an error because of a certificat problem (all my domain/sub-domain are well configured with let’s encrypt)
I hope it is more clear for you now
Perhaps another idea, although it may be more like a “hack”…
Install the redirect on ndd.TLD not on the root but in a path like ndd.TLD/wiki
In the admin interface, set the default application for ndd.TLD as the wiki redirect.
Now, when users go to ndd.TLD, they will be redirected to ndd.TLD/wiki and then wiki.ndd.TLD automatically.
However, your ndd.TLD will remain intact for the SSO, the mail or other stuff.
This won’t solve the root of the issue, but it may solve your specific problems for now…
Perhaps it could also be a problem in the redirect app… I saw this : https://stackoverflow.com/questions/41755100/how-to-redirect-only-the-root-path-in-nginx
Could you perhaps try to change the nginx conf file into
location ~ ^/$ {
Then save and reload nginx: sudo service nginx reload
What this would perhaps do is redirect only ndd.TLD but not ndd.TLD/yunohost or else
The redirect app should be improved. But if you are comfortable with manual configuration I can help.
- Make ndd.tld as your default domain again.
- Remove all the redirects.
- Edit
etc/ssowat/conf.json.persistent
and add"portal_domain": "admin.ndd.tld",
- Do
$yunohost app ssowatconf
- Add ndd.tld and www.ndd.tld with
$ yunohost domain add DOMAIN.TLD
- Install lets encrypt for both the domains i.e. ndd.tld and www.ndd.tld
7.Go toetc/nginx/conf.d/ndd.tld.d
- Add a text file redirect.conf and insert these lines.
location / {
return 301 $scheme://wiki.ndd.tld$request_uri;
}
8. Do same steps www .ndd.tld
9. Do $service nginx restart
@kanhu, I think I can do what you suggest. What bothers me is that I am not sure to be able to modify those files myself the day I decide to change something on my server…
Before following your advice, I would like to ask one question.
Is it possible to configure the redirection in order to redirect ndd.tld and www.ndd.tld to the wiki but to keep ndd.tld/www.ndd.tld shown in the browser url (I hope you can understand what I mean)
No it is not. Redirection itself means taking you other address. What do you want to do is alias address, which is app based like in nextcloud you can define two domain presenting same nextcloud instances. This is not Yunohost limitation.
But still you can try it through nginx configuration, some apps might work. My typical example is Zeronet. I have two domain for it. One for normal internet other for TOR.
You will have to copy the nginx configuration of /etc/nginx/config.d/wiki.ndd.tld.d/dokuwiki.config to /etc/nginx/config.d/www.ndd.tld.d/dokuwiki.config and /etc/nginx/config.d/ndd.tld.d/dokuwiki.config. Then restart nginx. This may work if Dokuwiki is ok with the alias address.
I disagree. It is possible by using the “proxy” setting in redirect_ynh.
But that wouldn’t be optimal.
The best would be to replace the nginx file with the exact same nginx used for wiki.ndd.TLD.
This way, both domains will behave the same.
This is supposing that the wiki accepts such behavior, which is perhaps @Kahnu point?
Hi,
I tried the “proxy setting” in redirect_ynh.
when I try to browse ndd.tld or www.ndd.tld, I get a “502 Bad Gateway”
Then Kahnu is right
Unless you try to customize the nginx conf file, I guess you are stuck with the “hack” then
I followed your instruction, and now I can not access to my website " 500 Internal Server Error"
However, redirection are working
You need to tell which of the website is giving 500 internal server error.
You can check the nginx log for the that website by:
$ tail -n 100 /var/logs/nginx/domain.tld.error.log
Hi @kanhu
the entire website returns 500 internal error (domain and sub-domain)
you can look at the log here
https://framabin.org/p/?75e70f72e087c6b4#24E9/hjy/C5qLU4I9TiBERXzt9LpQJ2rMTnGNV8WkGA=
Restart the server.
- Show me the configuration
etc/ssowat/conf.json.persistent
and the nginx file you edited.
here is the result
https://framabin.org/p/?0e4278596fb8f2ca#J+lXdOfMnviyKrQAGX6XnPi8QAW8wTAfSx9u4Nd+mRY=
I think you should respect the json syntax.There should be “,” after “redirected_urls”: {}. So the conf.json.persistance should be:
{
"redirected_urls": {},
"portal_domain" : "admin.ndd.org"
}
thank you @kanhu, I forgot the “,”
now, my server is working quite well
- redirection are ok
- I can access the user and admin interface
The only thing not working is the sso, it is ok with ttrss, not with nextcloud, dokuwiki
The sso will not work. You will have to manually enter the username and password.
ok, should I report a bug to improve redirect_ynh ?