nginx server block configuration not working

Hi There,

I’m a teacher at a school are we are trying to setup a Centos 7 Nginx server to host the kids work while they learn.

We followed the tutorial here at

When we complete the setup, we get a “Welcome to nginx!” page instead of the example page we created for testing.

We have gone over the configuration and googled around for about an hour, we’d really like to get this up before the kids are back on Monday.

Can anybody help us please, and what conf files do you need us to post to assist in the troubleshooting.

Thank you =)

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.


If you copied their example verbatim, then NGINX is going to pull content from:


This is defined by the root directive in the server block. To point that to your own directory, you will need to change that directive to match your custom directory.

So if you’re using:

server {
    listen  80;
    server_name localhost;

    location / {
        root  /usr/share/nginx/html;
        index  index.html index.htm;

    error_page  500 502 503 504  /50x.html;
    location = /50x.html {
        root  /usr/share/nginx/html;

You’ll need to change root /usr/share/nginx/html; in the location / block. There are, however, better ways to setup server blocks, but for the purpose of setting up an example, that’s all that you need to do.

Once you save the changes, you’ll need to restart NGINX using:

systemctl reload nginx


systemctl restart nginx

If we throw PHP, NodeJS, or another language in to the picture, we need to change things around.