ravi
ravi

Reputation: 103

NGINX is not loading my application even i mentioned the root

here is my chat application present in C:\chat1 which contains index.html and index.js files

here is the path i am setting like this in config file of NGINX.

server {
    listen       80;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   C:/chat1/;
        index  index.html index.htm;
    }

i changed forward slashes and backword slashes and changed to other application stil it is not loading instead it is show as welcome page as below

Welcome to nginx!

If you see this page, the nginx web server is successfully installed and working. Further configuration is required.

For online documentation and support please refer to nginx.org. Commercial support is available at nginx.com.

Thank you for using nginx.

can anyone please help me on this issue.. Thanks in advance.

Upvotes: 0

Views: 1761

Answers (1)

Tarun Lalwani
Tarun Lalwani

Reputation: 146520

You issue is that you are loading the default nginx config also. In case of multiple server blocks, the one that came first answers the request. In your case it is default nginx config block which is answer. So simple fix you can try is add default_server.

server {
    listen       80 default_server;
    server_name  localhost;

    #charset koi8-r;

    #access_log  logs/host.access.log  main;

    location / {
        root   C:/chat1/;
        index  index.html index.htm;
    }

If that doesn't help then you need delete the config of default server. You can see what config your nginx is actually loading by running nginx -T

Upvotes: 2

Related Questions