Same applies to $CFG->wwwroot. It must point to the name of the computer that Moodle is running on.
$CFG->dataroot must be OUTSIDE of your web path. In other words, it must not be accessible over the web. If you can access http://mydomain/X_Server/htdocs/moodledata via your web browser then you're putting your site at risk.