Quantcast
Channel: Nginx Forum - How to...
Viewing all 4759 articles
Browse latest View live

Re: nginx error "location" directive is not allowed here in

$
0
0
location is only allowed in server {} blocks.

Re: nginx error "location" directive is not allowed here in

$
0
0
itpp2012 Wrote:
-------------------------------------------------------
> location is only allowed in server {} blocks.

I have dealt with it, Thanks!!! Now gives an error message

nginx [45012]: nginx: [emerg] of invalid log level of "proxy_connect_timeout" in/etc/nginx/sites-enabled/nextcloud:126
Sep of the 25th 6:02:45 PM nextcloud nginx [45012]: nginx: configuration file/etc/nginx/nginx.conf test failed

Parameter in a config

proxy_connect_timeout 7200;
proxy_send_timeout 7200;
proxy_read_timeout 7200;
send_timeout 7200;

Here I won't understand any more where to expose this level of the log?

Re: nginx error "location" directive is not allowed here in

$
0
0
Since you messed up the server blocks you may very well have messed up other areas that suppose to be in server blocks and some that should be outside, have a good look at ALL .conf files, print them out and lay them on a table.

Re: nginx error "location" directive is not allowed here in

$
0
0
itpp2012 Wrote:
-------------------------------------------------------
> Since you messed up the server blocks you may very well have messed up
> other areas that suppose to be in server blocks and some that should
> be outside, have a good look at ALL .conf files, print them out and
> lay them on a table.

Thank you for councils everything has earned!!!

how to start serving

$
0
0
Hi. I am new to here and web stuff, haven't used apache before. Today I installed nginx for the first time, but all this stuff seems so hard to me. Why does it have to be so hard and complicated. Anyways, to begin with, I want to host a static website on my pc. It is simple html file that doesn't even have pictures in it, just some text. And I want it to be accessible from the internet. Anybody who type http://my.ip.add.ress in their browser must receive my webpage. This is how it works right? but don't know how to configure nginx to do that. please help. so far what i did, I edited index.html so it contains my text, when i type localhost in google chrome, that text is shown, but my friend who lives in other country says it doesn't work. how to make mywebpage go online?

Re: how to start serving

$
0
0
Hi, anybody here ? forum seems very passive.

Drawpile Server Administration using RestAPI through NGINX reverse proxy

$
0
0
I need NGINX to take hostname forwarding (free service from noip.com) to and forward the request to the drawpile server (multi user drawing application) on my raspberry pi. The drawpile server is currently configured to respond to 127.0.0.1:8080 only on the raspberry pi itself. I have a generated password file which is already in place. The following block code is placed at the bottom of the file default located in /etc/nginx/sites-enabled/

server {
listen 8080;
server_name localhost greywinde.servebeer.com;
allow all;
location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect default;
auth_basic "Server Administration";
auth_basic_user_file /etc/nginx/passwords;
}
}

The reason for using NGINX is as follows from the creator of drawpile: "The risk is that there could be a vulnerability in libmicrohttpd, which is the web server embedded in drawpile-srv, that can be exploited without sending a username and password. Such a vulnerability existing in nginx is highly unlikely."

I could be entirely wrong on how to set this up. I'm pretty darn new to Linux and I'm still bumping my way around it here. If you have any suggestions, even if it's related to my script to compile drawpile, it's appreciated. However the main focus at this point is just getting NGINX to work for administrating the drawpile server configuration. I hope this is enough details without being over the top, please feel free to ask for more if I omitted a detail in error.
---------------------------------------------------------------------------------------------
**Details**

Drawpile is set up to be activated by socket 27750 in systemd. I've included the script in case anyone is interested in testing it themselves. Once configured correctly with NGINX, you should be able to start drawpile-srv with the following line to connect to a remote drawpile server to configure it.

Drawpile Script and No-IP Scripts for use on Raspberry Pi 3, Raspbian 4.9
https://drive.google.com/drive/folders/0B1LTac-a237WMVNIWFg4RVJmRmc?usp=sharing

**Windows**
"C:\Program Files (x86)\Drawpile\drawpile-srv.exe" --gui --remote http://greywinde.servebeer.com:8080


**Linux**
drawpile-srv.exe --gui --remote http://greywinde.servebeer.com:8080
---------------------------------------------------------------------------------------------

One arm deployment with Stream Reverse Proxy

$
0
0
Hi

Anyone can share any example for one-arm deployment with TCP stream reverse proxy configuration in nginx ?

-Thiam Cheng

Re: Drawpile Server Administration using RestAPI through NGINX reverse proxy

$
0
0
To create a password for NGINX, remember to use the line that is below, substituting "username" for a desired login name.

htpasswd -c /etc/nginx/passwords username

Re: Drawpile Server Administration using RestAPI through NGINX reverse proxy

$
0
0
I think I figured out part of it at least.... I wasn't using the command to restart the NGINX process as I thought using the first command

sudo nginx -s reload

Would be enough. So I combined it with the command below...

sudo /etc/init.d/nginx restart

And now I'm at least getting somewhere. I think the problem I have now lies in how the information is being transferred between NGINX and Drawpile, so I don't think I need any more help. I might post here again with the final configuration used in NGINX to make it all work, once I figure out what that is exactly.

Problem after installation ngx_pagespeed

$
0
0
Hello everyone.
I am new and just starting my experience with Debian 8 64bit on VPS.
I have installed module from Gooogle automatic installation
bash <(curl -f -L -sS https://ngxpagespeed.com/install) \
--nginx-version latest
after this everything is Ok but I dont know what i should do now to enable module.
at the end is :
ngx_pagespeed is ready to be build against nginx.
when running ./configure:
Give ./configure the following arguments:
--add-module=/root/nginx_pagespeed-latest-stable
If this is for integration with an already-built nginx, make sure to include any other arguments you orginally passed to ./configure. you can see these with 'nginx -V'.
(more in attachment)
Can anyone help me to configure this to work ?


Bests regards
sorry for my english.
Wojciech

Re: Drawpile Server Administration using RestAPI through NGINX reverse proxy

$
0
0
In addition to the information given by Andrzej A. Flip (from https://superuser.com/questions/1254358/replace-single-line-with-multline-content-within-the-file-nginx-conf/1254557#1254557 ), you need to escape the semicolon (;), asterisk (*), and forward slash (/) characters. The \n makes it a new line, and use -i.bak to make a backup of the file before making the change with an .bak extension.

sudo sed -i.bak 's/^ include \/etc\/nginx\/sites-enabled\/\*\;$/&\n \n server {\n listen 8081\;\n \n location \/ {\n proxy_pass http:\/\/127.0.0.1:8080\/\;\n proxy_redirect default\;\n auth_basic "Server Administration"\;\n auth_basic_user_file \/etc\/nginx\/passwords\;\n }\n}\n/' /home/pi/Public/NGINX-test/nginx.conf

Reverse proxy MS OneDrive WebDav

$
0
0
Hi,
In my company there is a network policy that does not allows to access to MS OneDrive using with the client or by mapping the account as a webdav folder pointing the URL https://d.docs.live.net/XXXXXXXXXXX. (the url https://d.docs.live.net is blocked by the firewall).
Since the firewall allows to access to my home ip address where I have a raspberry running nginx, do you think is it possible to reverse proxy onedrive webdav access ? In other words, I want to map a webdav folder by pointing an address like this https://<my-public-raspberry-ip>/onedrive and the contex "/onedrive" should map to https://d.docs.live.net/<XXXXXXXX> where <XXXXXXXX> is my onedrive customer ID.
I already tried something like this but with no success:

location /onedrive {
dav_methods PUT DELETE MKCOL COPY MOVE;
dav_ext_methods PROPFIND OPTIONS;

set $destination $http_destination;

if ($destination ~* ^https(.+)$) {
set $destination http$1;
}

proxy_redirect off;
proxy_buffering off;
proxy_set_header Host $host;
proxy_set_header Destination $destination;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header ns_server-ui yes;
proxy_set_header X-Forwarded-User $http_authorization;
add_header Front-End-Https on;
proxy_pass_header Accept;
proxy_pass_header Server;
proxy_http_version 1.1;

proxy_pass https://d.docs.live.net;

}


Any suggestion ?

Regards

--
Nothingman

Logging all Set-Cookie headers

$
0
0
Greetings,

I'm am logging cookies set when nginx sends its response, but to my dismays I've noticed nginx only seems to log the first Set-Cookie header sent.

Can anyone tell me some way to log ALL Set-Cookie headers sent? I'm not finding anyway to do this.

Currently I'm logging via

log_format cookies $sent_http_set_cookie

thank to you!

play interruptions during reloads

$
0
0
Hi, nginx works great.

OBS streams live to debian rootserver with nginx + rtmp module installed.
I call with Firefox the url and player starts with flash plugin player and with html5 player perfectly.

But with html5 player it stops all 35 seconds for 2 seconds and there is a dotted circle
for waiting. There is no part missing but stopping is a bit annoying.

How to set nginx to load enough so it is not necessary to stop playing ?

Re: play interruptions during reloads

$
0
0
What I mean is for example:
Preload 10 second video and play it.
After 5 seconds playing preload next 10 seconds and so on ...
but with no stopping.

reloading nginx with tons of virtual hosts

$
0
0
Hi guys,
I'm having some strange behaviour with nginx. I've a website which provides services across multiple third level domains (something like sitea.example.com, siteb.example.com and so on)

The file with server aliases is created dynamically and nginx reloaded with a cron job.

I noticed that a simple "reload" is not enough to tell to nginx to reload (and eventually create) the file with new aliases.

I use a simple "include" in the server section, that points to the file with aliases.

Any ideas/suggestion?

Thank you

Problem nginx reverse proxy

$
0
0
Hello everybody,

First, sorry for mi English because I'm French.
I have a litle problem that I can't fix.
I have a web server in my lan accessible with https://lanserver url.
I have a domain name called toto.com that points to my nginx.
When I use https://toto.com in my browser, I have the same page that https://lanserver, so my nginx reverse proxy here works fine!

However, when I use https://toto.com/test.lol I'm not go to the same location that https://lanserver/test.lol, I have the following error:
=========
Erreur du serveur dans l'application '/'.
La ressource est introuvable.
Description : HTTP 404. La ressource recherchée (ou l'une de ses dépendances) a peut-être été supprimée ou renommée ou bien elle n'est plus disponible temporairement. Vérifiez l'URL ci-après et assurez-vous qu'elle est correcte.

URL demandée: /test.lol

Informations sur la version : Version Microsoft .NET Framework :2.0.50727.4211; Version ASP.NET :2.0.50727.4209
=========

In english somethink like that :
=========
Server error in "/" application.
Resource not found.

Description: HTTP 404. The searched resource (or one of its dependencies) may have been deleted or renamed, or it is no longer available temporarily. Check the URL below and make sure it is correct.

URL requested: /test.lol

Version information : Version Microsoft .NET Framework :2.0.50727.4211; Version ASP.NET :2.0.50727.4209
=========

My nginx configuration :
- upstream_toto.com.conf file :
=========
upstream backend_toto.com {
least_conn;
server lanserver:80 weight=5 max_fails=1 fail_timeout=10s;
}
=========

- toto.com.conf file :
=========
server {
listen 443 ssl;

server_name toto.com;


ssl_certificate /etc/nginx/ssl/coucou.info/coucou.info.crt;
ssl_certificate_key /etc/nginx/ssl/coucou.info/coucou.info.key;
ssl_protocols TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers ALL:!aNULL:!ADH:!eNULL:!LOW:!EXP:RC4+RSA:+HIGH:+MEDIUM;
ssl_verify_client off;

# gestion des logs
access_log /var/log/nginx/toto.com_access.log;
error_log /var/log/nginx/toto.com_error.log;

# Deny all for .htaccess, .htpasswd, .DS_Store (Mac).
location ~ /\. {
deny all;
access_log off;
log_not_found off;
}


location / {

allow xxx.xxx.xxx.xxx;
deny all;
proxy_pass http://backend_toto.com;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-Host $host;
proxy_set_header X-Forwarded-Server $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
}
}
=========

I have already tried a lot of things found on the net but all unsuccessful, I hope to be able to find here my answer!
How to route a path in nginx ?

Thank you for your help :)

Re: Problem nginx reverse proxy

$
0
0
OK it's good!

The lan web server aswerd just with 443 port.
It must put "proxy_pass https://backend_toto.com;" instead of "proxy_pass http://backend_toto.com;".

Re: Drawpile Server Administration using RestAPI through NGINX reverse proxy

$
0
0
***THIS QUESTION IS OFFICIALLY SOLVED.***
I would have deleted/edited posts if I could, but alas I cannot. So I'm posting a final update.
------------------------------------------------------------------------------------------------------------------------------
This is the actual configuration I used for NGINX, located in /etc/nginx/nginx.conf under the line "include /etc/nginx/sites-enabled/*;" See the attached image for proper formatting.

server {
listen 8081;

location / {
proxy_pass http://127.0.0.1:8080/;
proxy_redirect default;
auth_basic "Server Administration";
auth_basic_user_file /etc/nginx/passwords;
}
------------------------------------------------------------------------------------------------------------------------------
The line below is the line I use to insert my desired changes to NGINX by script.

sudo sed -i.bak 's/^ include \/etc\/nginx\/sites-enabled\/\*\;$/&\n \n server {\n listen 8081\;\n \n location \/ {\n proxy_pass http:\/\/127.0.0.1:8080\/\;\n proxy_redirect default\;\n auth_basic "Server Administration"\;\n auth_basic_user_file \/etc\/nginx\/passwords\;\n }\n}\n/' /etc/nginx/nginx.conf
------------------------------------------------------------------------------------------------------------------------------
And this is the final copy of the script I made for creating a drawpile server on the Raspberry Pi 3 running Raspbian Stretch 4.9.

https://docs.google.com/document/d/1l-3rYol468mpZg-TEo4d_zJt0ddpm6U_IlSz3nd6SlQ/edit
Viewing all 4759 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>