Question

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

Hello!

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
Answer a question...

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.

Best,

Bobby

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.

KFSys
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:

https://www.digitalocean.com/community/tutorials/how-to-install-the-apache-web-server-on-ubuntu-20-04