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

How to make nginx respect http_proxy and https_proxy (no replies)

$
0
0
Hello ,

I am using nginx as a reverse proxy server ,

I am running it on an internal organization which users proxy to go to the internet .

Explain :

When I am connecting from my linux box to google , I am going throw a proxy server

In order to authenticate with the proxy I need to define two environment variables

export http_proxys=http://proxy.org.com:443

and then every command that goes out from the machine , go throw the proxy .

now , I am going back to the nginx ,

I configured a stanze :

server {
listen 443 ssl;
keepalive_timeout 70;
fastcgi_param https_proxy http://kuku.blabla.com:443;
ssl_certificate ops.blabla.com.crt;
ssl_certificate_key ops.blabla.com.key;
ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2;
ssl_ciphers HIGH:!aNULL:!MD5;

location / {
proxy_pass https://mona.blabla.com ;
}

}

as you can see when I am sending a requests to the nginx , it proxy_pass me to https://mona.blabla.com ,

but , its not working since it looks like the nginx is not respecting the proxy configuration .

How can I make it happen ?

[1.6.0] "service nginx configtest" returns [fail], but why? (1 reply)

$
0
0
Running service nginx configtest on a LEMP-system (ubuntu 12.04 LTS) gives a [fail]. However, i've no clue why .. Is there a way to debug the parameter configtest or is there somewhere al log-file?

the rewrite_log for Nginx (no replies)

$
0
0
Hello, i have a web site working with Apache and based on mod_rewrite this code to be specific
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /

# Removes index.php from ExpressionEngine URLs
RewriteCond %{THE_REQUEST} ^GET.*index\.php [NC]
RewriteCond %{REQUEST_URI} !/system/.* [NC]
RewriteRule (.*?)index\.php/*(.*) /$1$2 [R=301,NE,L]

# Directs all EE web requests through the site index file
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
</IfModule>
and i have found some website that help translate it to Nginx configuration

# nginx configuration
location ~* /system/.* {
}
location / {
rewrite (.*?)index\.php/*(.*) /$1$2 redirect;
if (!-e $request_filename){
rewrite ^(.*)$ /index.php/$1 break;
}
}

but i don't know to get it working or how to activate it because i want to migrate from Apache to Nginx i have been searching for 3 weeks but no good information i am hoping i can find help here.
Thanks

Reduce response times (no replies)

$
0
0
I'm running a VPS with 1GB with Debian 7. Nginx's response time for static HTML files are around 300-500ms, which seems relatively high. These are not spikes, it's the average response time of single requests. No load tests or anything...

Is that normal? Shouldn't all static content be delivered in under 100ms?

This is my config: http://pastebin.com/BME76CdJ

Thanks a lot,
Simon

I'm only referring to the "Waiting" time. I'm ignoring the DNS Lookup, Connection time and Receiving time, not included.

Can I use upstreaming based on a URI regex? (no replies)

$
0
0
Hello,

I have an issue with our nginx conf.

How can I upstream to different machine clusters based on a URI.

I have tried the following within the server block,

if ($uri ~ ^/.*oo=oo*/) {upstream //bla}
if ($uri ~ ^/.*/) {upstream //blabla} (all the rest)

what am i doing wrong?

Can I use if for upstreaming?

Thanks,

Meir

Block anonym.to referes (no replies)

$
0
0
I'm using the following configuration to block all referers:

valid_referers none blocked domain.org;
if ($invalid_referer) {
return 403;
}

It works well.
But I'm receiving spam referring from anonym.to, which blanks the real referer. So it bypasses the block.
There's any way to block it permanently?

Rewrite query string nginx (no replies)

$
0
0
I am using this rewrite rule to redirect http://example.com/a-b-c?id=learn-more to ---> http://example.com/abc?id=learnmore

rewrite ^/a-b-c http://example.com/abc
rewrite ^/a-b-c?id=learn-More http://example.com/abc?id=learnMore permanent
But its not working !! It does redirect to

http://example.com/abc?id=learn-more (learn-more is not converted to learnmore ({Remove '-'}).

How to achieve this?

try_files brain crack (1 reply)

$
0
0
I want convert url like http://mysite.com/private/user1/file1.dat
to destination file as /host/userfiles/user1/private/file1.dat

I try this:
location ~/private/(.*)[/]?(.*)$ {
root /host/userfiles/$1/private;

try_files $2 @files_private_failed;
}
This example fallback to @files_private_failed.
Debugging shows that regexp vals $1 = "user1", $2="file1.dat". So, they are correct
The file /host/userfiles/user1/private/file1.dat also exists, with correct perms.

What is wrong with config?

Nginx 504 Bad Gateway Problem (Website freezing) (7 replies)

$
0
0
I'm using nginx with WT-NMP , i'm publishing important videos from my website and i have a lots of user. Sometime my website is freezing and anyonce can enter the website. I can't even enter my localhost. If i deny all permission on nginx.conf and change to "deny all" and add my ip "allow my ip" everything is fixing i can enter my localhost, and i can enter with my ip to my website. But if i try to let everyone with "allow all" my website is again freezing. I tried to add "limit_conn" etc but it did not work. Hope you can help me. I'm in bad position i need help , I'm open to all ideas.

Note: It is not about connection speed. I checked network traffic.

Invalid Config (no replies)

$
0
0
Hello, I have been trying to get help with my nginx config here: http://serverfault.com/questions/612871/nginx-config-not-displaying-right-site-for-subdomain

Nginx happily serves up the wrong site and doesn't complain about it in the log no matter what the log level is set to. I have been trying to set up a subdomain for 3 days. Lets just say I am not the biggest nginx advocate at the moment.

Here is the original post to save you going to server fault. Any help would be great!

----

My config below is not working for some reason, I have checked the following:

file ownership
file permission
nginx debug
the configs in sites-enabled and sites-available are symlinked
I assume the configs are readable or something would come up in the logs?
For some reason it is serving up the wrong page when I go to http(s)://vma.ottawakaraoke.com

I noticed that the error and access logs (as defined in config below) are empty. So obviously its not getting hits.

The host paramater in the request header is vma.ottawakaraoke.com - so I can confirm nginx should be picking up on the subdomain.

Also I have tried with and without the listen 80 part of the code.

I have been tailing nginx logs trying to find a fault but its just happily serving up the wrong site. Nginx so far is proving much more trouble than its worth. If anyone could help that would be great. Thanks.

server {
listen 80;
server_name vma.ottawakaraoke.com;
access_log /var/www/vma.ottawakaraoke.com/logs/access.log;
error_log /var/www/vma.ottawakaraoke.com/logs/error.log;
root /var/www/vma.ottawakaraoke.com/public_html/;

location / {
index index.html index.htm index.php;
}

location ~ \.php$ {
include /etc/nginx/fastcgi_params;
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $request_filename;
}
}

Nginx as reverse proxy with passwd auth. (no replies)

$
0
0
Hi, i'm using nginx as i wrote... is there any options limiting just one user per password in the moment ? Best regards.

Distributed config storage (1 reply)

$
0
0
Hi guys,

We have several proxy servers in US, EU and AU and now we use comit/fetch/reload strategy and git as config storage.
This method ok for little changes, but for now we are reloading nginx every 5 minutes, it's not good for my opinion.

I want to minimize reloading count, seems distributed storage is good solution for that.
Do you support any distributed storage (Zookeeper, DFS, etc.d or riak) for config files?

Do you have any out of the box solution for this case?

Monitor connections (no replies)

$
0
0
Hi,
I would like to monitor my Nginx load balancer with connection statistics (total active users, how many are on each node, etc.) similar to http://demo.nginx.com/status.html (note that I am using the "free" version of Nginx).

Does anyone know how can I accomplish this?

thank's in advance!

Nginx + Tomcat 6 + Subdomain jsp issues (no replies)

$
0
0
Hi everyone,

I have a problem in setting up a configuration with nginx as reverse proxy using subdomains ..

I have some apps on several servers , N apps on a tomcat server, N apps on a jboss server and I want to use Nginx as reverse proxy to prevent users from write port numbers or addressess too complicated.
Eg. I have, on tomcat server , webapp1 , webapp2 and so on.. I want that users could use webapps typing webapp1.domain.com or webapp2.domain.com instead of tomcatserver.domain.com:8080/webapp1 ..
So I have a server that is used to work as Reverse Proxy (Ubuntu server 14.04 and Nginx) that, in the matter of reverse proxy is configured in that way:

upstream tomcat_server {

server tomcat.domain.com:8080;
}
server {
listen 80;
location /webapp1 {
proxy_pass http://tomcat_server;
proxy_set_header Host $host;

}
}


and it works properly.
If I configure it with subdomains , I write a thing like that:

upstream tomcat_server {

server tomcat.domain.com:8080;
}
server{
listen 80;
server_name webapp1.domain.com;

location / {

proxy_pass http://tomcat_server/webapp1/;
sub_filter /webapp1/ /;
}

}
It works partially, because if I type webapp1.domain.com I see the correct login page, but if I do login I'm "redirected" on a page that is a mix between the login page and the page I should see (I have login forms and some parts of the page that should be) , as the user isn't able to be recognized in the session.

How could I fix this ?

Thanks

Luciana

Nginx + Apache Phpbb (no replies)

$
0
0
So I have nginx running, and have it running as a reverse proxy to Apache. Apache is my main webserver hosting a Phpbb forum. Now the problem I seem to having is that through nginx I can't log in to the forum. It shows the login, shows a success page, but as I return to the index, or any page it doesn't show me as logged in.

I've tried X-Forward-for, and setup the apache module rpaf, tried without any cache enabled, and I can't seem to get it to work. What I'd like to have is apache as the main server, with nginx acting as a cache server to serve requests but also allow logins. I plan to expand and have more nginx servers, and if someone could help me or direct me as to how to setup a proper nginx configuration to make this work, it'd be greatly appreciated.
The nginx server and apache server are not the same ip/server/country.

Purge using curl command (no replies)

$
0
0
Hi,

I need to know whether there is any way to achieve PURGE functionality without opting for commercial version of Nginx.

I tried "https://github.com/perusio/nginx-cache-purge" which works, but I need PURGE functionality only through curl (http call).

Regards,

Viral

Nginx as Load Bal to ADFS IIS (no replies)

$
0
0
I'm trying to configure an Nginx 1.7.3 as a load balancer to 2 backend ADFS servers running IIS 7.5 with windows authentication. All over SSL

upstream adfsproxy {
ip_hash;
server 1;
server 2;
keepalive 16;
}

server {
listen myserver:443 ssl;
server_name adfs.mydomain;
ssl on;
ssl_certificate cert.pem;
ssl_certificate_key cert.key;
ssl_session_cache off;
proxy_ssl_session_reuse off;
proxy_buffering on;
proxy_buffers 8 16k;
proxy_buffer_size 32k;

location / {
proxy_pass https://adfsproxy;
proxy_redirect default;
#Proxy Http Version 1.1 is recommended for use with keepalive connections.
proxy_http_version 1.1;
proxy_set_header Connection "";

} #end location

} #end of server

I'm getting strange results: First time it works but if someone else tries to login they login as the first person even though they are on different pc's. Is there a better why to tdo this ? I basically just want the traffic to be pass through.

NGINX + Subsonic + Custom port (2 replies)

$
0
0
I posted on the subsonic forum, but because I'm using nginx, maybe you guys can help.

you can find my post on subsonic here:
http://forum.subsonic.org/forum/viewtopic.php?f=2&t=14579&sid=068b793be70ade3f015d70feba253108&p=63831#p63831

my problem is, when using nginx (SSL:8443) to proxy subsonic (SSL:4141) I get a 502 bad gateway, and this error in the log:

2014/07/24 21:14:02 [error] 22465#0: *3 SSL_do_handshake() failed (SSL: error:14077438:SSL routines:SSL23_GET_SERVER_HELLO:tlsv1 alert internal error) while SSL handshaking to upstream, client: 10.66.26.1, server: subsonic.domain.org, request: "GET /favicon.ico HTTP/1.1", upstream: "https://127.0.0.1:4141/favicon.ico", host: "subsonic.domain.org:8443"

any idea?

Replace .php with backslash (no replies)

$
0
0
How would my try_files look if I wanted to have http://mydomain/script/ instead of http://mydomain/script.php ?

I am trying to configure auto-exchanger, it seems that if the url is http://mydomain/script/ script.php would be called but if the domain is http://mydomain/script/some/extra the latter two are passed as GET requests (script.php?some=extra). How can I achieve that?

rewrite question (no replies)

$
0
0
Hi,

I'm new to nginx and would like to rewrite some of my dynamic url's to friendly ones. The one particular one I am having trouble with is:

http://www.mysite.com/activities?utf8=%E2%9C%93&q%5Bsport_id_eq_any%5D%5B%5D=&q%5Bsport_id_eq_any%5D%5B%5D=47&q%5Btiming_option_start_time_eq_any%5D%5B%5D=&q%5Barea_id_eq_any%5D%5B%5D=&commit=APPLY

AND
http://www.mysite.com/activities?utf8=%E2%9C%93&q[sport_id_eq_any][]=&q[sport_id_eq_any][]=47&q[timing_option_start_time_eq_any][]=&q[area_id_eq_any][]=&commit=APPLY


for both of the above, I would like to rewrite the url without redirecting to http://www.mysite.com/acitivity/Yoga

Please let me know where is the best place in nginx to perform this change in the config file and what the change would be

thanks in advance.
Viewing all 2931 articles
Browse latest View live


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