Jump to content

Nginx-1.17.3 web server configuration.


Rewillis

Recommended Posts

Attention: W3Schools Forums members:

     I have recently downloaded the nginx-1.17.3 web server, and have configured it ( i.e., the "nginx.conf" file ).  The code for that file is as follows:


#user  nobody;
worker_processes  1;

#error_log  logs/error.log;
#error_log  logs/error.log  notice;
#error_log  logs/error.log  info;

#pid        logs/nginx.pid;


events {
    worker_connections  1024;
}

#
# Temporarily commented out as of Thursday, August 29, 2019.
#
#http {
#    include       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  logs/access.log  main;

#    sendfile        on;
    #tcp_nopush     on;

    #keepalive_timeout  0;
#    keepalive_timeout  65;

    #gzip  on;
   
   #
   # Begin: commented out as of Thursday, August 29, 2019.
   #
   #  server {
   #     listen       80;
   #     server_name  localhost;
   #
   #     #charset koi8-r;
   #
   #     #access_log  logs/host.access.log  main;
   #
   #     location / {
   #         root   html;
   #         index  index.html index.htm;
   #     }
   #
   #     #error_page  404              /404.html;
   #
   #     # redirect server error pages to the static page /50x.html
   #     #
   #     error_page   500 502 503 504  /50x.html;
   #     location = /50x.html {
   #         root   html;
   #     }
   #
        # proxy the PHP scripts to Apache listening on 127.0.0.1:80
        #
        #location ~ \.php$ {
        #    proxy_pass   http://127.0.0.1;
        #}

        # pass the PHP scripts to FastCGI server listening on 127.0.0.1:9000
        #
        #location ~ \.php$ {
        #    root           html;
        #    fastcgi_pass   127.0.0.1:9000;
        #    fastcgi_index  index.php;
        #    fastcgi_param  SCRIPT_FILENAME  /scripts$fastcgi_script_name;
        #    include        fastcgi_params;
        #}

        # deny access to .htaccess files, if Apache's document root
        # concurs with nginx's one
        #
        #location ~ /\.ht {
        #    deny  all;
        #}
#    }


    # another virtual host using mix of IP-, name-, and port-based configuration
    #
    #server {
    #    listen       8000;
    #    listen       somename:8080;
    #    server_name  somename  alias  another.alias;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}


    # HTTPS server
    #
    #server {
    #    listen       443 ssl;
    #    server_name  localhost;

    #    ssl_certificate      cert.pem;
    #    ssl_certificate_key  cert.key;

    #    ssl_session_cache    shared:SSL:1m;
    #    ssl_session_timeout  5m;

    #    ssl_ciphers  HIGH:!aNULL:!MD5;
    #    ssl_prefer_server_ciphers  on;

    #    location / {
    #        root   html;
    #        index  index.html index.htm;
    #    }
    #}

   http {
       #server {
       #    location / {
       #        root /data/www;
       #    }
       #
       #    location /images/ {
       #        root /data;
       #    }
   #}
       server_names_hash_bucket_size 64;
       sendfile  on;
       include mime.types;
       error_log  logs/error.log;
       error_log  logs/error.log  notice;
       error_log  logs/error.log  info;
       keepalive_timeout 65;
       default_type "text/html";
       server {
          listen  8080;
          server_name  bulletin.ddns.net;
          location /index31.html {
              autoindex on;
              root   c:/nginx-1.17.3/nginx-1.17.3/data/www/bulletin;
              #alias  c:/nginx-1.17.3/nginx-1.17.3/data/www/bulletin;
              index  index31.html index31.htm;
          }
   }
       server {
          listen  8080;
          server_name  holybible1.ddnsfree.com;
          location /index11a.html {
              autoindex on;
              root   c:/nginx-1.17.3/nginx-1.17.3/data/www/first;
              #alias  c:/nginx-1.17.3/nginx-1.17.3/data/www/first;
              index  index11a.html index11a.htm;
          }
   }
       server {
          listen  8080;
          server_name  theholybible.ddns.net;
          location /index1.html {
              autoindex on;
              root   c:/nginx-1.17.3/nginx-1.17.3/data/www/sermons;
              #alias  c:/nginx-1.17.3/nginx-1.17.3/data/www/sermons;
              index  index1.html index1.htm;
          }
   }
       server {
          listen  8080;
          server_name  holybible1.ddns.net;
          location /index3_41.html {
              autoindex on;
              root   c:/nginx-1.17.3/nginx-1.17.3/data/www/videoa;
              #alias  c:/nginx-1.13.7/nginx-1.17.3/data/www/videoa;
              index  index3_41.html index3_41.htm;
          }
   }
       server {
          listen  8080;
          server_name  theholybible1.ddnsfree.com;
          location /index_61.html {
              autoindex on;
              root   c:/nginx-1.17.3/nginx-1.17.3/data/www/introductory;
              #alias  c:/nginx-1.17.3/nginx-1.17.3/data/www/introductory;
              index  index_61.html index_61.htm;
          }
   }
       server {
          listen  8080;
          server_name  lesson.ddnsfree.com;
          location /AJAX_2.html {
              autoindex on;
              root   c:/nginx-1.17.3/nginx-1.17.3/data/www/lesson;
              #alias  c:/nginx-1.17.3/nginx-1.17.3/data/www/lesson;
              index  AJAX_2.html AJAX_2.htm;
          }
   }
       server {
          listen  8080;
          server_name  lessont.ddnsfree.com;
          location /AJAX_2.html {
              autoindex on;
              root   c:/nginx-1.17.3/nginx-1.17.3/data/www/lessont;
              #alias  c:/nginx-1.17.3/nginx-1.17.3/data/www/lessont;
              index  AJAX_2.html AJAX_2.htm;
          }
   }
       server {
          listen  8080;
          server_name  test1.lessont.ddnsfree.com;
          location /index66.html {
              autoindex on;
              root   c:/nginx-1.17.3/nginx-1.17.3/data/www/test1;
              #alias  c:/nginx-1.17.3/nginx-1.17.3/data/www/test1;
              index  index66.html index66.htm;
          }
   }
       server {
          listen  8080;
          server_name  theholybible1.com;
          location /index3_6.html {
              autoindex on;
              root   c:/nginx-1.17.3/nginx-1.17.3/data/www/vsom;
              #alias  c:/nginx-1.17.3/nginx-1.17.3/data/www/vxom;
              index  index3_6.html index3_6.htm;
          }
   }               
}

After configuration, I type in the following command at my Microsoft Windows 10 ( Home ) Edition command prompt ( in elevated mode ) :

c:\nginx-1.17.3\nginx-1.17.3>nginx -s reload

and the nginx web server is successfully started.  However, when I type the domain name of one of my web pages into one of my web browsers, I receive the following error message:

"This site can’t be reached

   bulletin.ddns.net’s server IP address could not be found.

             DNS_PROBE_FINISHED_NXDOMAIN."
 
I have the same web pages ( as shown in the above-given configuration file ) configured in another web server, and they serve up fine.  Why is my nginx-1.17.3 web server not serving up these web pages?  Thank you ( see Colossians 3:15, for example ) for your help.  Keep in touch. 😊
 
Sincerely in Christ,
Russell E. Willis
P.S. - Please read Proverbs 23:23.
Edited by Rewillis
Link to comment
Share on other sites

Hi there Russell,

Is this the first time you've set up a web server on your home PC? Is this going to be your local testing server? Is this something you want to be able to access externally?

You mentioned another web server, is this hosted online?

 

The error message shown indicates that your browser doesn't know where the server you've set up is.

If this server is not going to be externally accessed, have you set up your Windows hosts file?

Link to comment
Share on other sites

Attention: Funce:

     This is not the first time I have set up a web server on my personal computer system.  I have spent the past few years learning how to configure the Internet Information Services ( IIS ) Manager 10 ( in Microsoft Windows 10 ) web server, and the Apache version 2.4 web server.  Currently, the "Windows Process Activation Service" service, and the "World Wide Web Publishing Service" service are stopped, and I cannot restart them, which means that my web pages in IIS cannot be restarted.  I am currently using the Apache version 2.4 web server, but I would like to be able to solve the problems with IIS, while also figuring out how to get my nginx-1.17.3 web server to serve up my web pages.  All of my web servers are hosted on my personal computer system.  I am open to suggestions.  Thank you ( see Colossians 3:15, for example ) for your help and your patience.  Keep in touch. 😊

Sincerely in Christ,

Russell E. Willis

P.S. - Please read Proverbs 23:23.

Link to comment
Share on other sites

Attention: Funce:

     Editing the hosts file does not enable the nginx-1.17.3 web server to serve up my web pages.  Any other suggestions?  Thank you ( see Colossians 3:15, for example ) for your help.  Keep in touch. 😊

Sincerely in Christ,

Russell E. Willis

P.S. - Please read Proverbs 23:23.

Link to comment
Share on other sites

  • 4 weeks later...

Attention: Funce:

     This post is to acknowledge that you were correct with regard to the necessity of editing the hosts file, in order for the nginx-1.17.3 web server to serve up my web pages.  It was necessary to create "www.mydomain.com; mydomain.com" pairs associated with my dynamically allocated ( i.e., using Dynamic Host Configuration Protocol ( DHCP )) Internet Protocol ( IP ) address, for each web page.  Last Friday, I was able to successfully configure the web server ( i.e., the "nginx.conf" file ), and all of my web pages are served up ( you can visit "theholybible1.ddnsfree.com" ) if you like.  Thank you ( see Colossians 3:15, for example ) for your help.  Keep in touch. 🙂

 

Sincerely in Christ,

Russell E. Willis

P.S. - Please read Proverbs 23:23.

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...