As other answers have explained, it is impossible to prevent a third party host from being able to inspect the data on your server. What you can do however is make that data worthless to anyone who inspects it. If you can do that, then hosting your own physical server doesn't have to be the only solution.
Merely encrypting the data on the server isn't enough, and is completely useless against a determined attacker with access to the server. What you need is known as "zero knowledge" encryption and the extent and ease with which you can utilize it will depend on your server application. All encryption/decryption is done on the client side, and only encrypted data is ever transmitted to and stored on the server. The server never sees the unencrypted data at any point.
For example, a Dropbox-like file sync/storage service can achieve this fairly easily. The client encrypts files prior to uploading, and decrypts them after downloading. Anyone with direct access to the server will only be able to see the encrypted files. Another example with an easy solution is a messaging app, where encryption is done end to end. Each client transmits encrypted data via the server, with the other client performing decryption.
That alone will still leave the meta-data vulnerable. In the Dropbox eample, the attacker will be able to see file sizes, date stamps, etc. Whether or not that matters depends on your specific security needs of course, but if you want a full solution you will need to find a way to encrypt the meta data as well. Ideally you want to store a single stream of raw encrypted bytes on the server, and have all operations on it performed by the client.
Even then you will have to consider that the attacker might glean some information by analysing the amount and frequency of data that is transmitted to and from the client, as well as things like the client's IP address. That could be a problem in some contexts (e.g. people living under oppressive governments), but probably isn't for most applications.