Attempting to host a website with HTML and CSS...


I’ve been trying to figure this out all week and keep ending up the same solution. Maybe there’s a better way?

Anyways, I’m attempting to use my digital ocean server to host a website that has HTML and CSS. I have Nginx on my server and it is running and I have a website hosted. It turns out Nginx does not support CSS in any way or form.

How do I get around this? Or, is there something else I should be using outside of Nginx?

Thank you in advance!

Submit an answer

This textbox defaults to using Markdown to format your answer.

You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

Sign In or Sign Up to Answer

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.

Bobby Iliev
Site Moderator
Site Moderator badge
December 4, 2022

Hi there,

In addition to what has already been mentioned, you could also host your HTML + CSS static website for free on the DigitalOcean App Platform.

Here is a quick video on how to do that:

Hope that this helps.



Thank you so much for the feedback!

How do I access the config file?

I’m also not opposed to Apache. It’s not necessarily Nginx where I believe the issue is. I’m really new and the amount of new “how to” Nginx content that is available is unreal. I can show you 100 videos on how to hook up a static html website and not one that shows how to host multiple websites on a single server.

Anyways, thank you again for your time.

Site Moderator
Site Moderator badge
December 3, 2022

Hi @b54a07ce39b84b9987aec80a170775,

As explained by Sergio already, Nginx is not the cause of the CSS not displaying itself. Having said that, what you can add in your configuration file for your website is

 location ~* \.(js|jpg|png|css)$ {
    root /usr/share/nginx/html/;

Of course change the path /usr/share/nginx/html/; to your actual website path.

Additionally, if you are finding Nginx difficult, you can always use Apache as an alternative:

Try DigitalOcean for free

Click below to sign up and get $200 of credit to try our products over 60 days!

Sign up

card icon
Get our biweekly newsletter

Sign up for Infrastructure as a Newsletter.

Sign up
card icon
Hollie's Hub for Good

Working on improving health and education, reducing inequality, and spurring economic growth? We’d like to help.

Learn more
card icon
Become a contributor

You get paid; we donate to tech nonprofits.

Learn more
Welcome to the developer cloud

DigitalOcean makes it simple to launch in the cloud and scale up as you grow – whether you’re running one virtual machine or ten thousand.

Learn more ->
DigitalOcean Cloud Control Panel
Get started for free

Enter your email to get $200 in credit for your first 60 days with DigitalOcean.

New accounts only. By submitting your email you agree to our Privacy Policy.

© 2023 DigitalOcean, LLC.