I have a driver i need to distribute to my users, using an angular website, till here is ok, but the problem is here. The download is handled by nginx using "location" like this:
location /download/windows-driver.exe {
alias /opt/dist/windows/driver-windows-64-1.0.0.exe;
types { application/octet-stream; }
default_type application/octet-stream;
add_header Content-disposition "attachment";
}
location /download/linux-driver.run {
alias /opt/dist/linux/driver-linux-amd64-1.0.0.run;
types { application/octet-stream; }
default_type application/octet-stream;
add_header Content-disposition "attachment";
}
Then my question is, every time i upgrade my driver version, should i go manually to nginx and change it? isn't there any way to make it dynamic?
I've been searching a way to make nginx use some unix commands to read the driver folder and user the latest version, but i have not been successful.
Any solution or clarification will be appreciated, Thank you.
Related
How can i create a healthcheck for container. I have nginx running as openresty container, and i am trying to create a health check. I followed the steps from https://sleeplessbeastie.eu/2020/03/09/how-to-use-openresty-to-perform-health-checks/
But didnt have luck.
i keep getting: curl http://127.0.0.1:8090/health/http -v
404 Not Found
Did you follow the entire article?
In the mid section, it asks to add this.
location /ping {
access_log off;
default_type "text/html";
return 200 "pong\n";
}
location /health/nginx {
default_type "text/html";
content_by_lua_file health/nginx.lua;
}
Note initially, the tutorial says
local url = "http://127.0.0.1"
but later, it's changed to
local url = "http://127.0.0.1/ping"
I'm creating a Nginx file server, and I'm trying to enable the fancy-index module to get have custom header and footer, but I can't get it working, the header/footer never load. (The request isn't even done from the browser).
For now, I've followed this tutorial : https://neilmenon.com/blog/install-nginx-fancyindex
My current config for the site is
server {
listen 80;
server_name myname;
autoindex on;
autoindex_exact_size off;
autoindex_localtime on;
location / {
root /var/www/html
fancyindex on;
fancyindex_exact_size off;
fancyindex_footer /fancy-index/footer.html;
fancyindex_header /fancy-index/header.html;
fancyindex_css_href /fancy-index/style.css;
fancyindex_time_format "%B %e, %Y";
}
}
I've also loaded the module in the nginx.conf on the first line of the file
load_module /usr/share/nginx/modules/ngx_http_fancyindex_module.so;
I also clarify that I am new to nginx, so I apologize if this is a common issue that I should be aware of.
Thanks in advance, any help would be much appreciated
I wasn't able to find a solution to use fancy index however, I've got a workaround by using the module ngx_http_addition_module on which fancy index is based.
This module is here : https://nginx.org/en/docs/http/ngx_http_addition_module.html
Basically, the configuration goes as follows :
location / {
root /var/www/html
addition_types text/html; # Replace this with watever mime type this server is responding
add_before_body /fancy-index/header.html; # Replace the fancyindex_header
add_after_body /fancy-index/footer.html; # Replace the fancyindex_footer
}
You don't have the possibility to link a stylesheet from these directives or changes the time format, but nothing prevent to load a stylesheet from the header and adding a script in it for the time.
I had the same problem. The issue is coming from the fact that you enable autoindex.
To fix the issue you need to comment the line that reference autoindex
I'm trying to dabble in Nginx and making my first server thingie, but it's not working. Here is my config file
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
location / {
root ~/42cursus/ft_server/tests/www;
}
location /images/ {
root ~/42cursus/ft_server/tests;
}
}
include servers/*;
}
I've been following this beginner's guide : https://nginx.org/en/docs/beginners_guide.html. The only thing I did different was delete the commented lines in the default config file in order for it to be clearer to me.
Whenever I send nginx -s reload, I get a "signal process started" added to my error.log, and trying to access the site via localhost just shows This.
Could someone help me, keeping in mind that I'm on a school computer and can't use SUDO ? Thank you in advance.
Added "listen 80;" to my server block, and now I get a 404 instead of nothing, at least that's progress !
I have an ember.js application I developped on my local machine. I use a restify/node.js server to make it available locally.
When I navigate in my application, the address bar changes like this:
Example 1
1. http://dev.server:3000/application/index.html#about
2. http://dev.server:3000/application/index.html#/items
3. http://dev.server:3000/application/index.html#/items/1
4. http://dev.server:3000/application/index.html#/items/2
I try now to deploy it on a remote test server which runs nginx.
Although everything works well locally, I can navigate into my web application but the part of the URI that is after the hashtag is not updated.
In any browser: http://test.server/application/index.html is always displayed in my address bar. For the same sequence of clicks as in Exemple 1, I always have:
1. http://web.redirection/application/index.html
2. http://web.redirection/application/index.html
3. http://web.redirection/application/index.html
4. http://web.redirection/application/index.html
Moreover, if I directly enter a complete URI http://web.redirection/application/index.html#/items/1 the browser will only display the content that is at http://test.server/application/index.html (which is definitely not the expected behaviour).
I suppose this come from my NGINX configuration since the application works perfectly on a local restify server.
NGINX configuration for this server is:
test.server.conf (which is symlinked into /etc/nginx/sites-enabled/test.server.conf)
server {
server_name test.server web.redirection;
root /usr/share/nginx/test;
index index.html index.htm;
location / {
try_files $uri $uri/ /index.html;
}
location ~ \.csv$ {
alias /usr/share/nginx/test/$uri;
}
}
nginx.conf
user www-data;
worker_processes 4;
pid /var/run/nginx.pid;
events {
worker_connections 768;
}
http {
sendfile on;
tcp_nopush on;
tcp_nodelay on;
keepalive_timeout 65;
types_hash_max_size 2048;
include /etc/nginx/mime.types;
default_type application/octet-stream;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log debug;
gzip on;
gzip_disable "msie6";
include /etc/nginx/conf.d/*.conf;
include /etc/nginx/sites-enabled/*;
}
EDIT:
Just to be sure that there were no missing files on my test server: I ran a restify/node server (like on my dev machine) and everything works fine when I connect to this server (!). Both nginx and restify servers points to the same files.
EDIT 2
I discovered that my problem happens when I use a web redirection.
If I use an address like http://test.server/application/index.html everything works fine
If I use http://web.redirection/application/index.html it does not work.
So this is my nginx conf that is not correctly redirecting web.redirection URI to test.server or something like that.
Does someone has an idea ? What do I miss ? What should I change to make this work ?
EDIT 3 and solution
The web redirection I used was an A type DNS record. This does not work. Using a CNAME type DNS record solves the issue.
No, this has nothing to do with nginx, any thing past the # is never sent to the server, a javascript code should handle this, I would suggest to use firebug or any inspector to make sure that all your js files are being loaded, and nothing fails with a 404 error, also check for console errors on the inspector console.
The problem came from the DNS redirection from web.redirection to test.server.
It was an A-type record: this does not work.
Using a CNAME-type record that points directly to test.server works.
I have installed Nginx 1.2.0 with Passenger on my Mac Mini running Lion Server. I used the instructions from the link below.
https://github.com/coverall/nginx
I will state upfront that I am new to Nginx & Passenger. I am working on a Ruby on Rails project that I would like to host on the server. When I try to start Nginx I get the following error:
[emerg] unknown directive "upload_pass" in /usr/local/etc/nginx/virtualhosts/adam.localhost.coverallcrew.com.conf:20
Here are lines 19 & 20 from the file in question. This is a file that I assume was included in the Nginx installation. The only config file I have done anything with is nginx.conf where I added the lines to hopefully host my Rails application.
# pass request body to here
upload_pass #fast_upload_endpoint;
This is my second attempt at doing extensive web searches on how to correct this error. I had hoped to find if I needed to add something to nginx.conf or something to get upload_pass defined somewhere but only found solutions where the directive was indeed missing.
I took a look at nginx.conf. There are a lot of statements commented out. Here are the ones that are not:
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
gzip on;
server_name_in_redirect off;
port_in_redirect off;
client_max_body_size 8m;
client_body_buffer_size 128k;
include upstreams/*.conf;
include virtualhosts/*.conf;
include third-party/*.conf;
server {
listen 8080;
server_name www.lightbesandbox2.com;
root /Sites/iktusnetlive_ror/public;
passenger_enabled on;
}
}
Another question: Do I need these virtual hosts that were including in the Nginx install?
Any help would be appreciated.
It appears your Nginx is not compiled with the upload_pass module so it does not understand that directive. I am not certain how to do this with homebrew, but you can compile it in:
./configure --add-module=/path/to/upload_pass/source