Search code examples
nginxnetwork-programmingwebservercentos7

I add nginx config of domain but my domain is not going online


I want to add a domain manually with cli of centos 7 and created a config file in sites-available directory:

server {
    listen  80;
    server_name hustana.ir www.hustana.ir;

    location / {
        root  /home/www/public_html;
        index  index.html index.htm;
        try_files $uri $uri/ =404;
    }

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

In my server there is another domains that are online and works fine. if its help I should tell that at start my server was worked by Plesk Obtisian control panel

but now I wanna add another domain to server just but it`s not working.

I changed my domain NS from domain control center.

additional description:

I guess it`s good to say that if I delete the config block of one of my older domains , domain still stay online but it displays just a blank white page.

I tried add to include this config file from another directory directly into nginx.conf:

server {

listen 80;

server_name hustana.ir;

root   /home/www/public_html;

index index.php;

location ~ \.php$ {
    try_files $uri =404;
    fastcgi_pass unix:/var/run/php-fpm/php-fpm.sock;
    fastcgi_index index.php;
    fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    include fastcgi_params;
}

}

Solution

    1. You need to enable your site as mentioned here.
    2. Check the A-record of your domain. It must point to your server IP.