Why are my server blocks not working on nginx CentOS, they redirect to default nginx folder?

I was following this guide here:

here are my two pages:

Both show the default Nginx page.

conf.d folder is empty.


server {
  listen 80;

  location / {
    root /home/damian/;
    index index.html index.htm;
    try_files $uri $uri/ =404;


server {
  listen 80;

  location / {
    root /home/damian/;
    index index.html index.htm;
    try_files $uri $uri/ =404;

I did the system links to the sites-enabled. I restarted nginx and it shows the default nginx page.


user nginx;
worker_processes auto;
error_log /var/log/nginx/error.log;
pid /run/;

# Load dynamic modules. See /usr/share/nginx/README.dynamic.
include /usr/share/nginx/modules/*.conf;

events {
    worker_connections 1024;

http {
    log_format  main  '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for"';

    access_log  /var/log/nginx/access.log  main;

    sendfile            on;
    tcp_nopush          on;
    tcp_nodelay         on;
    keepalive_timeout   65;
    types_hash_max_size 2048;

    include             /etc/nginx/mime.types;
    default_type        application/octet-stream;

    # Load modular configuration files from the /etc/nginx/conf.d directory.
    # See
    # for more information.
    include /etc/nginx/conf.d/*.conf;

    include /etc/nginx/sites-enabled/*.conf;
    server_names_hash_bucket_size 64;

    server {
        listen       80 default_server;
        listen       [::]:80 default_server;
        server_name  _;
        root         /usr/share/nginx/html;

        # Load configuration files for the default server block.
        include /etc/nginx/default.d/*.conf;

        location / {                                                                                                         }

        error_page 404 /404.html;
            location = /40x.html {

        error_page 500 502 503 504 /50x.html;
            location = /50x.html {

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.

Hi @alexdo, I have the same problem. Although in recent nginx version on CentOS 7 there is no /conf.d fonder on /etc/nginx. So what can be wrong? Any idea?

Thanks for any help

Hi @damiantoczek did you fix this?

Hello, @damiantoczek

Would you mind checking in the vhosts directory:


The individual config files should be there. On my CentOS 7 / Nginx server this is the directory where you edit/adjust the virtual hosts for the domains.

Let me know how it goes. Alex