Question
Hosting more than one domain on a droplet -- will setting up virtual hosts break my current mysql setup?
I have a mysql database that I currently access with a php file, in the following setup:
[my site’s current url]/php/scores.php
Within the php file, I connect to the database through ‘localhost’.
The problem is, I’d like to start hosting more than one domain on my droplet. I read about implementing virtual hosts. That’s fine, and I can move my php files to match up to the new url subdirectories in the virtual host root folder.
However, the php files access the mysql database through 'localhost’. Once I setup virtual hosts, will that need to change? Or is mysql 'localhost’ location independent of any virtual hosting setup?
Thanks!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×