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!
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!
Hi @b54a07ce39b84b9987aec80a170775,
Nginx is a computer program that processes a server-side application, making bidirectional or unidirectional and synchronous or asynchronous connections with the client and generating or giving a response in any language or client-side application.
However, your CSS file is processed by your browser.
Check out this tutorial where explains how to create and configure a virtualhost for your new website.
How To Set Up Nginx Server Blocks (Virtual Hosts) on Ubuntu 16.04
Hope that helps,
Sergio Turpín
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:
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.
Get paid to write technical tutorials and select a tech-focused charity to receive a matching donation.
Full documentation for every DigitalOcean product.
The Wave has everything you need to know about building a business, from raising funding to marketing your product.
Stay up to date by signing up for DigitalOcean’s Infrastructure as a Newsletter.
New accounts only. By submitting your email you agree to our Privacy Policy
Scale up as you grow — whether you're running one virtual machine or ten thousand.
Sign up and get $200 in credit for your first 60 days with DigitalOcean.*
*This promotional offer applies to new accounts only.