Sunlight is believed to be a major cause of skin cancer, and I agree that it is, but that has its reasons.
Fact is that skin cancer, just like a lot of other types of cancer and chronic diseases, has become a lot more common in just the last 100 years or so.
We were out in the sun more back then, as we were through all of evolution, without getting skin cancer for it.

The Real Reason We Get Skin Cancer From The Sun (And How To Avoid It)
And the real reason, as with other chronic disease, that the sun causes cancer is because of all the omega-6-rich vegetable oils that we’re eating.
That’s good news, since it then means it’s both preventable and reversable.
You just need to stop consuming these oils for a few years (2-5).
The reason is that they build up in our cell membranes proportionally to how much of them we eat.

And since they’re in everything, they’re in you.
Also, there’s evidence that even with increased skin cancer risk from the sun, sun exposure reduces the risk of other types of cancer and disease more than it increases skin cancer risk, meaning it’s still a net positive to bask in the sun.
So..
Go ahead and reduce your omega-6 intake, and go ahead and get some sunlight!
/Emil