NGINX questions

Another newbie question…

When installing the nginx rock-on the config screen says to create a config and data share. I did that and after the install I went to check what was in there so I could start learning a little about setting up a web page/site and low and behold there was nothing in there. After finding the conf file at /etc/nginx I was able to at least start looking at the config. So my questions

1- Does nginx ever actually use the 2 shares I setup? If not can I delete them?
2- Is there a setup guide for this in Rockstor that I can follow? All the doc I have found has not been much help.
3- The server name field is confusing for me. Do I just makeup a domain name? Do I just make up an ip or use the same ip as the box. If I run it as below I try to connect with 192.xxx.xxx.49:8080 and it times out and then I can’t coonnect to Rockstor without rebooting.
4- what goes into vhosts.d and Conf.d directories?

My current ip for Rockstor in 192.xxx.xxx.49 and I assume it is using port 80 but then it changes it to an https:// address so I can logon.

Here is my current conf

vault:/etc/nginx # cat nginx.conf

user nginx;
worker_processes 1;

# load_module lib64/nginx/modules/ngx_http_fancyindex_module.so;
# load_module lib64/nginx/modules/ngx_http_headers_more_filter_module.so;
# load_module lib64/nginx/modules/ngx_http_image_filter_module.so;
# load_module lib64/nginx/modules/ngx_http_perl_module.so;
# load_module lib64/nginx/modules/ngx_http_xslt_filter_module.so;
# load_module lib64/nginx/modules/ngx_mail_module.so;
# load_module lib64/nginx/modules/ngx_rtmp_module.so;
# load_module lib64/nginx/modules/ngx_stream_module.so;

#error_log /var/log/nginx/error.log;
#error_log /var/log/nginx/error.log notice;
#error_log /var/log/nginx/error.log info;

#pid /var/run/nginx.pid;

events {
worker_connections 1024;
use epoll;
}

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  /var/log/nginx/access.log  main;

sendfile        on;
#tcp_nopush     on;

#keepalive_timeout  0;
keepalive_timeout  65;

#gzip  on;

include conf.d/*.conf;

server {
    listen       8080;
    server_name  amazing1.com www.amazing1.com;

    #charset koi8-r;

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

    location / {
        root   /srv/www/htdocs/;
        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   /srv/www/htdocs/;
    }

    # 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           /srv/www/htdocs/;
    #    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   /srv/www/htdocs/;
#        index  index.html index.htm;
#    }
#}


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

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

#    Allow TLS version 1.2 only, which is a recommended default these days
#    by international information security standards.
#    ssl_protocols        TLSv1.2;

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

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

#    location / {
#        root   /srv/www/htdocs/;
#        index  index.html index.htm;
#    }
#}

include vhosts.d/*.conf;

}

UPDATE>>>>>>> No matter how much time I spend on this I can’t figure it out. It seems that Rockstor somehow has it’s hands in this. I should be able in the config files to figure out how nginx is getting the request and serving the pages.
1- How does nginx server know where to go when I just put in the server address in my browser. It must be listening on port 80 but I can’t find that in the conf files.
2- If I use the Rockon button for the web UI then nginx should be listening on port 1080 and serving up the page but I can’t find that in the conf files either.
3- No mattert how I configure the default.conf file I can’t get a reply from the nginx server
4-How do I tell if a port is listening. For example I should be able to see that nginx is listening on port 1080 to serve up the default page.

HELP PLEASE or point me to somewhere I can go or someone I can ask. This is making me crazy for the last week.

@Stevek Hello again.

Many of your questions are very nginx specific, and so are best asked on an nginx forum or from their docs.

But keep in mind that this nginx instance is not associated with anything Rockstor as such. We just manage the install start/stop of the docker container. So you will need some knowledge of docker here also. This is an advanced user Rock-on but should be approachable if you follow the directions in the more_info icon within the installed rock-on.

All info we use for this Rock-on is in it’s definition here:

Where you can also see the more_info data. That give an on-boarding of sorts.

Just keep in mind that this is not the systems nginx: that is configured by Rockstor as it uses the same for the Web-UI and a bunch of stuff. So best leave that be. This nginx is run inside of docker so has it’s own OS essentially. And you have to treat it as entirely independant from the openSUSE instance that we use: running on the bare-meta as it were. And keep in mind that docker can redirect ports to the host. That we can do via the Rock-on install.

Start there and let us know how you get on. We don’t have docs for this Rock-on and it is intended for those who already have knowledge of nginx: but you are aquiring some now :).

Apologies for having little time to help here. But those more-info directions are intended to get up up-and-running - from memory. It may be we have updating to do here. But this Rock-on was tested when it was accepted: but that was a long time ago. Keep us updated on progress.

Hope that helps.

2 Likes

Phil,

Thanks so much!!! The piece I was missing is that the rockons are in a docker and it runs in like a VM. This put me on the right path and I realize after your note that I was making changes to the system nginx server and not the rockon docker server. No apologies needed we are all real busy these days.

For anyone looking to use the nginx rockon YOU MUST understand the differences in these 2 distinct environments or it will make you crazy!!!

Now I have spend a couple of days getting an understanding of what a docker is and how to talk to it and then how to talk to nginx server running in docker.

Phil I hope I can get some time to doocument this at least a little so others do not have to go through the learning curve I did. Where would be the best place to post something like that?

Thanks again for taking the time to answer all my posts.

3 Likes

@Stevek Hello again, and glad you got this more sorted.

Docker is quite the jump at first, not quite a VM but like a VM, but not as obviously so!

That would be great. We have a dedicated doc sub-section in our:

“Rock-ons (Docker Plugins)”: Rock-ons (Docker Plugins) — Rockstor documentation

entitled:

Rock-ons with write-ups: Rock-ons (Docker Plugins) — Rockstor documentation

Possibly a new simple entry there: Expaining mostly our part as it were: i.e. linking to upstream info on configuration etc. There are a number of other entries to copy from, and they all start pretty much the same.

Hopefully this is not too much of a rabit hole: but to contribute to our docs we have a docs section for that also :slight_smile: :

https://rockstor.com/docs/contribute/contribute_documentation.html

Take a peek and see if that takes your fancy, this particular Rock-on is intended for Advanced users, and states as much, but as you indicate: a little write-up can go a long way. It was rather a terse Rock-on to start-out on actually. If you do embark on this: do keep in mind our part of the explanation: we need only link to canonical documentation from upstream. And emphasise base requirements for function within Rockstor: or limitations etc. Again, take a look at the other write-up there and see if they help. You also likely need no pics for this Rock-on write-up: given no Web-UI as such.

It may also be that some further explanation would help in our overview section (first link above). See what you think and thanks for thinking of contributing; always much appreciated.

2 Likes