nginx server block configuration not working

Posted February 4, 2017 6k views

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 =)

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.

Submit an Answer
1 answer


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.