SYSTEM INFORMATION | |
---|---|
OS type and version | Ubuntu Linux 20.04.5 |
Webmin version | [2.021] |
Virtualmin version [7.5] | |
hello, im trying to make 2 website have the same database, i searched in google and found this article (dangerous article link removed) but i dont really understand it… | |
can someone tell me another way to to it, or explain this (another dangerous article link removed) more… |
If it was my project, I would setup two websites, install the database on one of them. The other one I just point to the database of the first one in the configuration.
Could that work for you?
With Virtualmin you can create two virtual servers, aka 2 domains aka 2 websites.
Of course there are other options, like installing two websites on one virtual server and than based on the domain name, forward them internal with mode rewrite. But to me the first option seems the easiest and simply to maintain.
Btw, just curious. Why would you want this? Two websites with the same database and content is seen as duplicate content and would not have any benefits in Google for example. Or is it something totally different?
hi @Mikky23 , and yes thats what im doing i have 2 domain names ( 2 virtual servers), but idk how to point the database of the first website on the configuration to the second website, can u explain how ( and think for me as a newbie…)
and yes it is duplicate, but not for the same domain so it will help in google cuz its 2 different domains…
Hi,
Two different domain with the exact same content can be problematic, but feel free to try (if it would work in google, I would setup a 100 copies myself right away ).
I’m not aware of your skill level, but if I explain it basic. Say you created one virtual server. Then you create a database and of course note the database name, the user name and the password. You than install the website on one server and use these database configuration. Than you install the second website on the second virtual server and you use the same database configuration. If you use the correct username/password, every website on the same server can acces this. It is not like a database is restricted to a single virtual server.
Here you find a video example to setup a database in webmin: https://www.youtube.com/watch?v=0UF2VC5jVdk
@Mikky23 the first virtual server is done (1 domain with wordpress and the database), from what i understand i create the second virtual server with its new database? and then i use the database configuration? idk tbh…
and in the video he drop a database and then create a new one??? i dont get it…
Please don’t follow any instructions you find on the “Bob Cares” website. I don’t know if it is intentionally harmful or accidentally so, but everything I’ve looked at there has been wrong, sometimes in dangerous ways.
I’ll remove the links from your post, because I don’t want anyone ending up there thinking it has some useful information.
Webmin has nothing to do with your websites and what databases they use.
Assuming your apps are written to be able to share a database safely, then you would just configure them both to connect to the same database.
If they are not written to share a database, but have overlapping table names or stored functions or whatever, then it would be dangerous to try to have them use the same database.
Webmin does not use a database for any of its functionality. (I’m kinda repeating myself, but I want to make sure you’re getting the point that Webmin is irrelevant to your problem.)
@Joe thanks i didnt know about “Bob Cares” too tbh…
someone told me i can use it so my tryin, well ig it aint working then…
I really cannot see the business case for this unless the domains are closely linked (eg. one is an alias of the other) If they are just sharing the basic mysql db for Virtualmin then I would just keep them separate. If there is a good business case then (especially if the db was not mysql) I would put the db up on its own server and have done (even a managed solution)
The db size per VS is very small.
If its a duplicate website then just create a alias domain. SEO won’t like it as its duplicate content so you need to have a rel=“canonical” as a meta tag
My thoughts on using the same database for 2 different domains
- Yes it is feasible by perhaps just changing the one web apps config to point at the other web app’s database, by using the username and password from the ‘master apps’ installation.
- You must be aware of the app storing some of its configuration to the database, for example it may store it’s base url in the database and may perhaps prepend this to all links to make the links absolute rather than relative.
- The app may also store cookies under the url stored in the database, so therefore the other copy of the software may not read the correct data from the cookie (for example some bits of software use a cookie in order to speed up the login process and this maybe wrong).
- you need to be aware of any possible data collisions if both pieces of software happen to be writing to the same database record(s) at the same time, this can cause unexpected results.
I need to be able to do this for a client and never got it to work correctly so in the end I ditched the software and wrote a complete unique piece of software to do this, which tbf took quite a while to perfect but does work.
If the second domain is only interacting by reading the data ( and doesn’t interact with the data in any other way) point 1 should work OK
thanks @Stegan @stefan1959 @jimr1 i will try them and see, if i doesnt work i will just hire a developer…
Use different prefix for the install’s databases
install_1_table1
install_1_table2
install_1_table3
and
install_2_table1
install_2_table2
install_2_table3
Same database user to connect, no fancy solution but works and is visible. For the prefix “install_X” use whatever you’d like.
I guess the OP wants to share the tables and have a second set in the same database
tbh i aint skilled enough to understand everything about ‘tables and how to create them or how to configure them’
and i found someone to do it anyway so thanks everyone
Seems to be the best option. Hope the end product works for you .
thanks and i hope so