nginx doesn't serve files

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite












I have copied a directory into /var/www named mysite; then I created a file in sites-available in order to setup configuration to point to this directory (/etc/nginx/sites-available/mysite) and a symlink of it in sites-enabled (/etc/nginx/sites-enabled/mysite):



server 
listen 4000 default_server;
listen [::]:4000 default_server;

root /var/www/otsui;

index index.html;

server_name _;

location /
try_files $uri $uri/ =404;





But when I try to get http://localhost:4000/, I get This site can’t be reached page which means nothing is being served.



I have also tried restarting nginx service.



I have a debian jessie.



These are my firewalls:



root@mylab:/var/www# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination
DOCKER-USER all -- anywhere anywhere
DOCKER-ISOLATION all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain DOCKER (2 references)
target prot opt source destination

Chain DOCKER-ISOLATION (1 references)
target prot opt source destination
DROP all -- anywhere anywhere
DROP all -- anywhere anywhere
RETURN all -- anywhere anywhere

Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere


I have also tried copying my web-site files into the default directory, i.e. /var/www/html; but navigating to http://127.0.0.1:3000/ in the browser still shows me nginx welcome page, even though I made a restart to the nginx service.







share|improve this question


















  • 1




    Test the configuration using nginx -T. But index.html; is not a legal statement, did you mean index index.html;?
    – Richard Smith
    Nov 18 '17 at 14:13











  • Perhaps stating the obvious, but is there a firewall active? Type iptables -L (as root) to check.
    – maulinglawns
    Nov 18 '17 at 14:29










  • @RichardSmith, my mistake. I fixed it, but still same results happen.
    – Zeinab Abbasimazar
    Nov 20 '17 at 5:45










  • @maulinglawns, nothing to worry about, I think. But I will post it in the question. Would you please check it?
    – Zeinab Abbasimazar
    Nov 20 '17 at 5:47














up vote
1
down vote

favorite












I have copied a directory into /var/www named mysite; then I created a file in sites-available in order to setup configuration to point to this directory (/etc/nginx/sites-available/mysite) and a symlink of it in sites-enabled (/etc/nginx/sites-enabled/mysite):



server 
listen 4000 default_server;
listen [::]:4000 default_server;

root /var/www/otsui;

index index.html;

server_name _;

location /
try_files $uri $uri/ =404;





But when I try to get http://localhost:4000/, I get This site can’t be reached page which means nothing is being served.



I have also tried restarting nginx service.



I have a debian jessie.



These are my firewalls:



root@mylab:/var/www# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination
DOCKER-USER all -- anywhere anywhere
DOCKER-ISOLATION all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain DOCKER (2 references)
target prot opt source destination

Chain DOCKER-ISOLATION (1 references)
target prot opt source destination
DROP all -- anywhere anywhere
DROP all -- anywhere anywhere
RETURN all -- anywhere anywhere

Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere


I have also tried copying my web-site files into the default directory, i.e. /var/www/html; but navigating to http://127.0.0.1:3000/ in the browser still shows me nginx welcome page, even though I made a restart to the nginx service.







share|improve this question


















  • 1




    Test the configuration using nginx -T. But index.html; is not a legal statement, did you mean index index.html;?
    – Richard Smith
    Nov 18 '17 at 14:13











  • Perhaps stating the obvious, but is there a firewall active? Type iptables -L (as root) to check.
    – maulinglawns
    Nov 18 '17 at 14:29










  • @RichardSmith, my mistake. I fixed it, but still same results happen.
    – Zeinab Abbasimazar
    Nov 20 '17 at 5:45










  • @maulinglawns, nothing to worry about, I think. But I will post it in the question. Would you please check it?
    – Zeinab Abbasimazar
    Nov 20 '17 at 5:47












up vote
1
down vote

favorite









up vote
1
down vote

favorite











I have copied a directory into /var/www named mysite; then I created a file in sites-available in order to setup configuration to point to this directory (/etc/nginx/sites-available/mysite) and a symlink of it in sites-enabled (/etc/nginx/sites-enabled/mysite):



server 
listen 4000 default_server;
listen [::]:4000 default_server;

root /var/www/otsui;

index index.html;

server_name _;

location /
try_files $uri $uri/ =404;





But when I try to get http://localhost:4000/, I get This site can’t be reached page which means nothing is being served.



I have also tried restarting nginx service.



I have a debian jessie.



These are my firewalls:



root@mylab:/var/www# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination
DOCKER-USER all -- anywhere anywhere
DOCKER-ISOLATION all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain DOCKER (2 references)
target prot opt source destination

Chain DOCKER-ISOLATION (1 references)
target prot opt source destination
DROP all -- anywhere anywhere
DROP all -- anywhere anywhere
RETURN all -- anywhere anywhere

Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere


I have also tried copying my web-site files into the default directory, i.e. /var/www/html; but navigating to http://127.0.0.1:3000/ in the browser still shows me nginx welcome page, even though I made a restart to the nginx service.







share|improve this question














I have copied a directory into /var/www named mysite; then I created a file in sites-available in order to setup configuration to point to this directory (/etc/nginx/sites-available/mysite) and a symlink of it in sites-enabled (/etc/nginx/sites-enabled/mysite):



server 
listen 4000 default_server;
listen [::]:4000 default_server;

root /var/www/otsui;

index index.html;

server_name _;

location /
try_files $uri $uri/ =404;





But when I try to get http://localhost:4000/, I get This site can’t be reached page which means nothing is being served.



I have also tried restarting nginx service.



I have a debian jessie.



These are my firewalls:



root@mylab:/var/www# iptables -L
Chain INPUT (policy ACCEPT)
target prot opt source destination

Chain FORWARD (policy ACCEPT)
target prot opt source destination
DOCKER-USER all -- anywhere anywhere
DOCKER-ISOLATION all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere ctstate RELATED,ESTABLISHED
DOCKER all -- anywhere anywhere
ACCEPT all -- anywhere anywhere
ACCEPT all -- anywhere anywhere

Chain OUTPUT (policy ACCEPT)
target prot opt source destination

Chain DOCKER (2 references)
target prot opt source destination

Chain DOCKER-ISOLATION (1 references)
target prot opt source destination
DROP all -- anywhere anywhere
DROP all -- anywhere anywhere
RETURN all -- anywhere anywhere

Chain DOCKER-USER (1 references)
target prot opt source destination
RETURN all -- anywhere anywhere


I have also tried copying my web-site files into the default directory, i.e. /var/www/html; but navigating to http://127.0.0.1:3000/ in the browser still shows me nginx welcome page, even though I made a restart to the nginx service.









share|improve this question













share|improve this question




share|improve this question








edited Nov 21 '17 at 5:33

























asked Nov 18 '17 at 13:39









Zeinab Abbasimazar

1519




1519







  • 1




    Test the configuration using nginx -T. But index.html; is not a legal statement, did you mean index index.html;?
    – Richard Smith
    Nov 18 '17 at 14:13











  • Perhaps stating the obvious, but is there a firewall active? Type iptables -L (as root) to check.
    – maulinglawns
    Nov 18 '17 at 14:29










  • @RichardSmith, my mistake. I fixed it, but still same results happen.
    – Zeinab Abbasimazar
    Nov 20 '17 at 5:45










  • @maulinglawns, nothing to worry about, I think. But I will post it in the question. Would you please check it?
    – Zeinab Abbasimazar
    Nov 20 '17 at 5:47












  • 1




    Test the configuration using nginx -T. But index.html; is not a legal statement, did you mean index index.html;?
    – Richard Smith
    Nov 18 '17 at 14:13











  • Perhaps stating the obvious, but is there a firewall active? Type iptables -L (as root) to check.
    – maulinglawns
    Nov 18 '17 at 14:29










  • @RichardSmith, my mistake. I fixed it, but still same results happen.
    – Zeinab Abbasimazar
    Nov 20 '17 at 5:45










  • @maulinglawns, nothing to worry about, I think. But I will post it in the question. Would you please check it?
    – Zeinab Abbasimazar
    Nov 20 '17 at 5:47







1




1




Test the configuration using nginx -T. But index.html; is not a legal statement, did you mean index index.html;?
– Richard Smith
Nov 18 '17 at 14:13





Test the configuration using nginx -T. But index.html; is not a legal statement, did you mean index index.html;?
– Richard Smith
Nov 18 '17 at 14:13













Perhaps stating the obvious, but is there a firewall active? Type iptables -L (as root) to check.
– maulinglawns
Nov 18 '17 at 14:29




Perhaps stating the obvious, but is there a firewall active? Type iptables -L (as root) to check.
– maulinglawns
Nov 18 '17 at 14:29












@RichardSmith, my mistake. I fixed it, but still same results happen.
– Zeinab Abbasimazar
Nov 20 '17 at 5:45




@RichardSmith, my mistake. I fixed it, but still same results happen.
– Zeinab Abbasimazar
Nov 20 '17 at 5:45












@maulinglawns, nothing to worry about, I think. But I will post it in the question. Would you please check it?
– Zeinab Abbasimazar
Nov 20 '17 at 5:47




@maulinglawns, nothing to worry about, I think. But I will post it in the question. Would you please check it?
– Zeinab Abbasimazar
Nov 20 '17 at 5:47










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










I solved the issue; the problem was that I have not included /etc/nginx/sites-enabled/ in /etc/nginx/nginx.conf in order to load configs from. After a restart on the nginx service, my web application was completely deployed.



I should mention that I also checked the output of command nginx -t in order to be sure every change in the nginx configurations are OK; the output for a successful re-configuration is:



nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful


BTW, this is my nginx configurations now:



user nginx;
worker_processes 1;

error_log /var/log/nginx/error.log warn;
pid /var/run/nginx.pid;


events
worker_connections 1024;



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

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;

keepalive_timeout 65;

#gzip on;

# include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;






share|improve this answer




















    Your Answer







    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "106"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f405433%2fnginx-doesnt-serve-files%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote



    accepted










    I solved the issue; the problem was that I have not included /etc/nginx/sites-enabled/ in /etc/nginx/nginx.conf in order to load configs from. After a restart on the nginx service, my web application was completely deployed.



    I should mention that I also checked the output of command nginx -t in order to be sure every change in the nginx configurations are OK; the output for a successful re-configuration is:



    nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
    nginx: configuration file /etc/nginx/nginx.conf test is successful


    BTW, this is my nginx configurations now:



    user nginx;
    worker_processes 1;

    error_log /var/log/nginx/error.log warn;
    pid /var/run/nginx.pid;


    events
    worker_connections 1024;



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

    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;

    keepalive_timeout 65;

    #gzip on;

    # include /etc/nginx/conf.d/*.conf;
    include /etc/nginx/sites-enabled/*;






    share|improve this answer
























      up vote
      0
      down vote



      accepted










      I solved the issue; the problem was that I have not included /etc/nginx/sites-enabled/ in /etc/nginx/nginx.conf in order to load configs from. After a restart on the nginx service, my web application was completely deployed.



      I should mention that I also checked the output of command nginx -t in order to be sure every change in the nginx configurations are OK; the output for a successful re-configuration is:



      nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
      nginx: configuration file /etc/nginx/nginx.conf test is successful


      BTW, this is my nginx configurations now:



      user nginx;
      worker_processes 1;

      error_log /var/log/nginx/error.log warn;
      pid /var/run/nginx.pid;


      events
      worker_connections 1024;



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

      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;

      keepalive_timeout 65;

      #gzip on;

      # include /etc/nginx/conf.d/*.conf;
      include /etc/nginx/sites-enabled/*;






      share|improve this answer






















        up vote
        0
        down vote



        accepted







        up vote
        0
        down vote



        accepted






        I solved the issue; the problem was that I have not included /etc/nginx/sites-enabled/ in /etc/nginx/nginx.conf in order to load configs from. After a restart on the nginx service, my web application was completely deployed.



        I should mention that I also checked the output of command nginx -t in order to be sure every change in the nginx configurations are OK; the output for a successful re-configuration is:



        nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
        nginx: configuration file /etc/nginx/nginx.conf test is successful


        BTW, this is my nginx configurations now:



        user nginx;
        worker_processes 1;

        error_log /var/log/nginx/error.log warn;
        pid /var/run/nginx.pid;


        events
        worker_connections 1024;



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

        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;

        keepalive_timeout 65;

        #gzip on;

        # include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;






        share|improve this answer












        I solved the issue; the problem was that I have not included /etc/nginx/sites-enabled/ in /etc/nginx/nginx.conf in order to load configs from. After a restart on the nginx service, my web application was completely deployed.



        I should mention that I also checked the output of command nginx -t in order to be sure every change in the nginx configurations are OK; the output for a successful re-configuration is:



        nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
        nginx: configuration file /etc/nginx/nginx.conf test is successful


        BTW, this is my nginx configurations now:



        user nginx;
        worker_processes 1;

        error_log /var/log/nginx/error.log warn;
        pid /var/run/nginx.pid;


        events
        worker_connections 1024;



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

        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;

        keepalive_timeout 65;

        #gzip on;

        # include /etc/nginx/conf.d/*.conf;
        include /etc/nginx/sites-enabled/*;







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 25 '17 at 11:14









        Zeinab Abbasimazar

        1519




        1519



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f405433%2fnginx-doesnt-serve-files%23new-answer', 'question_page');

            );

            Post as a guest













































































            Popular posts from this blog

            How to check contact read email or not when send email to Individual?

            Bahrain

            Postfix configuration issue with fips on centos 7; mailgun relay