The denotative meaning of the phrase "under the sun" in Ecclesiastes is "on earth," and this is neutral in meaning. Something being "under the sun" just means it is on the earth. Indeed, "within the realm of God's dominion" would fit there.
However, words and phrase also have connotative meanings that flow out of context and depending on the speaker. For example, the denotative meaning of "home" is "where you live." The connotative meaning for you might be one of security.
When we consider "under the sun" based on the generally negative tone of Ecclesiastes, we see a negative side to the phrase. When we further consider that "under the sun" would be synonymous with "under heaven" and heaven is the realm of God, we can easily arrive at a connotative meaning of "without God." But on further reflection, a better understanding would be "the physical world." It must be remembered that this is contrasted to the spiritual world, above the sun.
Ecclesiastes 1:3 What advantage does man have in all his work Which he does [in the physical world]?
Ecc 1:9 That which has been is that which will be, And that which has been done is that which will be done. So there is nothing new [in the physical world].
Ecclesiastes 1:14 I have seen all the works which have been done [in the physical world], and behold, all is vanity and striving after wind.
Ecclesiastes 2:11 Thus I considered all my activities which my hands had done and the labor which I had exerted, and behold all was vanity and striving after wind and there was no profit [in the physical world].
Ecclesiastes 2:17 So I hated life, for the work which had been done [in the physical world] was grievous to me; because everything is futility and striving after wind.
Ecclesiastes 2:18 [ The Futility of Labor ] Thus I hated all the fruit of my labor for which I had labored [in the physical world], for I must leave it to the man who will come after me.
Ecclesiastes 2:20 Therefore I completely despaired of all the fruit of my labor for which I had labored [in the physical world].
Ecclesiastes 2:22 For what does a man get in all his labor and in his striving with which he labors [in the physical world]?
Ecclesiastes 3:16 ¶ Furthermore, I have seen [in the physical world] that in the place of justice there is wickedness and in the place of righteousness there is wickedness.
Ecclesiastes 4:1 [ The Evils of Oppression ] Then I looked again at all the acts of oppression which were being done [in the physical world]. And behold I saw the tears of the oppressed and that they had no one to comfort them; and on the side of their oppressors was power, but they had no one to comfort them.
Ecclesiastes 4:3 But better off than both of them is the one who has never existed, who has never seen the evil activity that is done [in the physical world].
Ecclesiastes 4:7 Then I looked again at vanity [in the physical world]. 8 There was a certain man without a dependent, having neither a son nor a brother, yet there was no end to all his labor. Indeed, his eyes were not satisfied with riches and he never asked, “And for whom am I laboring and depriving myself of pleasure?” This too is vanity and it is a grievous task.
Ecclesiastes 4:15 I have seen all the living [in the physical world] throng to the side of the second lad who replaces him.
Ecclesiastes 5:13 There is a grievous evil which I have seen [in the physical world]: riches being hoarded by their owner to his hurt.
Ecclesiastes 5:18 Here is what I have seen to be good and fitting: to eat, to drink and enjoy oneself in all one’s labor in which he toils [in the physical world] during the few years of his life which God has given him; for this is his reward.
Ecclesiastes 6:1 [ The Futility of Life ] There is an evil which I have seen [in the physical world] and it is prevalent among men—
Ecclesiastes 6:12 For who knows what is good for a man during his lifetime, during the few years of his futile life? He will spend them like a shadow. For who can tell a man what will be after him [in the physical world]?
Ecclesiastes 8:9 All this I have seen and applied my mind to every deed that has been done [in the physical world] wherein a man has exercised authority over another man to his hurt.
Ecclesiastes 8:15 So I commended pleasure, for there is nothing good for a man [without God] except to eat and to drink and to be merry, and this will stand by him in his toils throughout the days of his life which God has given him [in the physical world].
Ecclesiastes 8:17 and I saw every work of God, I concluded that man cannot discover the work which has been done [in the physical world]. Even though man should seek laboriously, he will not discover; and though the wise man should say, “I know,” he cannot discover.
Ecclesiastes 9:3 This is an evil in all that is done [in the physical world], that there is one fate for all men. Furthermore, the hearts of the sons of men are full of evil and insanity is in their hearts throughout their lives. Afterwards they go to the dead.
Ecclesiastes 9:6 Indeed their love, their hate and their zeal have already perished, and they will no longer have a share in all that is done [in the physical world].
Ecclesiastes 9:9 Enjoy life with the woman whom you love all the days of your fleeting life which He has given to you [in the physical world]; for this is your reward in life and in your toil in which you have labored [in the physical world].
Ecclesiastes 9:11 ¶ I again saw [in the physical world] that the race is not to the swift and the battle is not to the warriors, and neither is bread to the wise nor wealth to the discerning nor favor to men of ability; for time and chance overtake them all.
Ecclesiastes 9:13 Also this I came to see as wisdom [in the physical world], and it impressed me.
14 There was a small city with few men in it and a great king came to it, surrounded it and constructed large siegeworks against it. 15 But there was found in it a poor wise man and he delivered the city by his wisdom. Yet no one remembered that poor man. 16 So I said, “Wisdom is better than strength.” But the wisdom of the poor man is despised and his words are not heeded. 17 The words of the wise heard in quietness are better than the shouting of a ruler among fools. 18 Wisdom is better than weapons of war, but one sinner destroys much good.
Ecclesiastes 10:5 There is an evil I have seen [in the physical world], like an error which goes forth from the ruler—
This connotative meaning works throughout the book whereas "without God" has places where it does not work.
"Of the physical world" is not quite the same as "without God", but it should be remembered that it contrasts to "the spiritual world."