непонятный баг, контент с другого домена

2014-06-13 Thread AlexFC
Здравствуйте!

Столкнулся со следующей проблемой:
Возникает на каждом новом юзере, воспроизводится.
Создаю новый ввв-домен, можно с новым пользователем, можно на существующем.
Обращаюсь http://домен/images/logo.png (или что угодно другое из статики не
существующей в этом домене).
Получаю в ответ картинку другого пользователя.
В логе nginx вижу, что обращение происходит к другому пользователю, 
хотя в nginx.conf явно прописаны server_name для обоих доменов, никаких
вайлдкардов, никаких особых конфигов, просто 2 обычных пользователя.
Делаю service nginx restart, проблема уходит, получаю 404.
Если я после этого пересоздам домен, все будет нормально.
Если же я удалю домен, сделаю nginx restart, и создам опять, проблема опять
возникает.
nginx reload не помогает!

Немного о системе:
Centos 6.x, ISPManager 4 Pro
NGINX + Apache + PHP FastCGI

NGINX обновил до 1.6.0, не помогло.

Буду рад любому совету, спасибо!

Ну и немного конфигов:
Конфиг домена, с которого отдается статика (индивидуальные данные заменил):
server {
server_name somedomain.com www.somedomain.com;
listen 1.2.3.4;
set $root_path /var/www/username/data/www/somedomain.com;
location ~* ^.+\.(jpg|jpeg|gif|png|svg|js|css|mp3|ogg|mpe?g|av
i|zip|gz|bz2?|rar|swf)$ {
root $root_path;
access_log /var/www/nginx-logs/username isp;
access_log /var/www/httpd-logs/somedomain.com.access.log ;
error_page 404 = @fallback;
}
location / {
proxy_pass http://1.2.3.4:81;
proxy_redirect http://1.2.3.4:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location ~* ^/(webstat|awstats|webmail|myadmin|pgadmin)/ {
proxy_pass http://1.2.3.4:81;
proxy_redirect http://1.2.3.4:81/ /;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location @fallback {
proxy_pass http://1.2.3.4:81;
proxy_set_header Host $host;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_set_header X-Real-IP $remote_addr;
}
location ^~ /webstat/ {
auth_basic Restricted area;
auth_basic_user_file /var/www/username/data/etc/138789.passwd;
try_files $uri @fallback;
}
include /usr/local/ispmgr/etc/nginx.inc;
}

Вполне себе стандартный конфиг сгенерированный ISPManager, такой же у всех
остальных +/-

nginx.conf:
user nginx;worker_processes 10;
worker_rlimit_nofile 32768;

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 Module
#
# http://wiki.nginx.org/NginxHttpEventsModule
#
#--

events {
worker_connections 1024;
}


#--
# HTTP Core Module
#
# http://wiki.nginx.org/NginxHttpCoreModule
#
#--

http {
include /etc/nginx/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';
log_format main2 '$remote_addr - $remote_user [$time_local] $request $host
'
'$status $body_bytes_sent $http_referer '
'$http_user_agent $http_x_forwarded_for';

access_log /var/log/nginx/access.log main2 buffer=32k;

sendfile on;
#tcp_nopush on;

#keepalive_timeout 0;
keepalive_timeout 65;
proxy_read_timeout 2000;
proxy_connect_timeout 300;
proxy_cache_path cache levels=1 keys_zone=my-cache:20m max_size=1000m
inactive=600m;
proxy_temp_path cache/tmp;
server_names_hash_max_size 32768;
proxy_buffers 8 16k;
proxy_buffer_size 32k;

#gzip on;

# Load config files from the /etc/nginx/conf.d directory
# The default server is in conf.d/default.conf
include /etc/nginx/conf.d/*.conf;

open_file_cache max=2 inactive=20s;
open_file_cache_valid 30s;
open_file_cache_min_uses 2;
open_file_cache_errors on;

client_max_body_size 160M;
log_format isp '$bytes_sent $request_length';
server {
.
далее конфиги доменов (типовые)

в conf.d значимый только default.conf:
server {
listen 80 default_server;
server_name _;

#charset koi8-r;

#access_log logs/host.access.log main;

location / {
root /usr/share/nginx/html;
index index.html index.htm;
}

error_page 404 /404.html;
location = /404.html {
root /usr/share/nginx/html;
}

# redirect server error pages to the static page /50x.html
#
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root /usr/share/nginx/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 

Re: непонятный баг, контент с другого домена

2014-06-13 Thread Maksim Kulik
Здравствуйте!
Посмотрите в сторону
http://nginx.org/ru/docs/http/ngx_http_proxy_module.html#proxy_cache_key
Вам надо включить в proxy_cache_key переменную $host (как минимум).


13 июня 2014 г., 11:51 пользователь AlexFC nginx-fo...@nginx.us написал:

 Здравствуйте!

 Столкнулся со следующей проблемой:
 Возникает на каждом новом юзере, воспроизводится.
 Создаю новый ввв-домен, можно с новым пользователем, можно на существующем.
 Обращаюсь http://домен/images/logo.png
 http://xn--d1acufc/images/logo.png (или что угодно другое из статики не
 существующей в этом домене).
 Получаю в ответ картинку другого пользователя.

 Posted at Nginx Forum:
 http://forum.nginx.org/read.php?21,250834,250834#msg-250834

 ___
 nginx-ru mailing list
 nginx-ru@nginx.org
 http://mailman.nginx.org/mailman/listinfo/nginx-ru
___
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru

Re: непонятный баг, контент с другого домена

2014-06-13 Thread AlexFC
Глобально кеш не используется, кеш был активирован для одного из доменов, не
домена X и не тестового, для чистоты эксперимента убрал, и вычистил из
конфига все что касается proxy_cache*
И на сколько я понимаю это все же кеширование динамического контента от
апача, который в данном случае вообще не задействован.
Прибиваю апач вообще проблема таже самая, это статика отдаваемая NGINX.

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?21,250834,250837#msg-250837

___
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru

Re: непонятный баг, контент с другого домена

2014-06-13 Thread denis

13.06.2014 12:51, AlexFC пишет:

Здравствуйте!

Столкнулся со следующей проблемой:
Возникает на каждом новом юзере, воспроизводится.
Создаю новый ввв-домен, можно с новым пользователем, можно на существующем.
Обращаюсь http://домен/images/logo.png (или что угодно другое из статики не
существующей в этом домене).
Получаю в ответ картинку другого пользователя.
В логе nginx вижу, что обращение происходит к другому пользователю,
хотя в nginx.conf явно прописаны server_name для обоих доменов, никаких
вайлдкардов, никаких особых конфигов, просто 2 обычных пользователя.
Делаю service nginx restart, проблема уходит, получаю 404.
возможно, не было релоада, имеет смысл создать ветку на форуме 
ispmanager. Без релоада должно отдавать файлы default домена или того, 
кто первый в списке.



Если я после этого пересоздам домен, все будет нормально.
Если же я удалю домен, сделаю nginx restart, и создам опять, проблема опять
возникает.
nginx reload не помогает!
практика показывает, что в некоторых версиях линей reload при ошибке в 
конфиге говорит ОК, но ничего не рестартит, поэтому у меня уже привычка 
сначала делать nginx -t или service nginx configtest. Но чтобы рестарт 
при этом помогал - это похоже на баг. Был например баг с 
mod_passenger+freebsd, после релоада руби ломался, надо было делать 
именно рестарт, но с той поры года 2 прошло.



Проверил, при условии что на тестовом домене отдается картинка домена X,
если на тестовом домене положить вместо нее другую картинку, отдаваться
будет все равно картинка домена X, а вот если положить картинку с другим
именем файла, то будет отдаваться правильно - файл с тестового домена.
похоже на какой-то кэш. Может браузера? Вообще такие вещи надо 
тестировать курлом. Нет ли еще промежуточных серверов, которые могут 
кэшировать? Что при полном удалении упоминаний кэширования?


___
nginx-ru mailing list
nginx-ru@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-ru

Rtmp Module and LibRtmp

2014-06-13 Thread MrDaniel
Hello.

I am seeking advice and suggestions for this issue with nginx and the rtmp
module

I have been working with RTMP. Previously i have worked with cRtmpServer,
however nginx seems better for extending the service later on, further down
the line.

I am using nginx from this source, which works with my flash player.
http://nginx-win.ecsds.eu/

It seem Nginx and libRtmp can work together.

http://stackoverflow.com/questions/23629913/capture-camera-and-publish-video-with-librtmp

Nginx config, this works with my flash test player for both applications.

http://pastebin.com/j2eVWzEg 

I wish to connect with librtmp, and i am using the setopt functions so that
librtmp has a url, port, app, playpath.  Currently, my code connects and
also connects to the stream.  However, only about 9bytes are returned when
reading a packet.

Here is my libRtmp C++ code.

https://groups.google.com/forum/#!topic/c-rtmp-server/HMYfrrs0Bus

LibRTMP page with param list.

http://rtmpdump.mplayerhq.hu/librtmp.3.html

So that's the first issue. Connecting properly, so that we can read a file.

Now, for the next part... recording. The solution to the first part, may
result in both working.

I would also like to record to the server with librtmp. The first link,
above, shows how to record using libRtmp to nginx when the params are
correct for connecting.  How do i configure the server to publish a live
stream, so that many clients can access it?? Ideally, we don't want to
record video to the server just transport it.

Any help moving forward would be good. Suggestions, advice, anything that
anyone can recommend trying.

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,250839,250839#msg-250839

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


How could I forbid outside visits without response 403

2014-06-13 Thread ????
Hi Buddy,
I am a newer to Nginx world, now I have a project to link the varnish HTTP 
server and nginx together, nginx is the back end.


I want to allow the connections only by varnish, so I use deny all ,this kind 
of stuff to archieve this.


But if there is a way to compeletely forbid the connections, at present, even 
the outside connections is forbidden, but I think it still waste some 
resourses, RETURN A 403 STATIC PAGE..


I will not use a iptables..




Thank you everyone !!


I would appreciate very much..___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Re: Rtmp Module and LibRtmp

2014-06-13 Thread MrDaniel
Further to this.

Here is the log for working swf and not working libRTMP

Flash.swf

127.0.0.1 [06/Jun/2014:12:28:23 -0700] PLAY vod bunny.flv  - 1037
400014 http://dl.dropboxusercontent.com/u/2918563/flvplayback.swf; WIN
13,0,0,214 (1m 34s)


LibRTMP

127.0.0.1 [07/Jun/2014:12:44:39 -0700] PLAY vod bunny.flv  - 306 25553
  (1m 5s)

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,250839,250842#msg-250842

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re: Rtmp Module and LibRtmp

2014-06-13 Thread itpp2012
Specific rtmp issues are better placed here:
https://groups.google.com/forum/#!forum/nginx-rtmp

Posted at Nginx Forum: 
http://forum.nginx.org/read.php?2,250839,250843#msg-250843

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx


Re: How could I forbid outside visits without response 403

2014-06-13 Thread B.R.
What you describe is by design the job of firewalls... in your case
dropping unwanted connections rather that rejecting them.

1 tool = 1 task
---
*B. R.*


On Fri, Jun 13, 2014 at 4:14 PM, 姚锟 627...@qq.com wrote:

 Hi Buddy,
 I am a newer to Nginx world, now I have a project to link the varnish HTTP
 server and nginx together, nginx is the back end.

 I want to allow the connections only by varnish, so I use deny all ,this
 kind of stuff to archieve this.

 But if there is a way to compeletely forbid the connections, at present,
 even the outside connections is forbidden, but I think it still waste some
 resourses, RETURN A 403 STATIC PAGE..

 I will not use a iptables..


 Thank you everyone !!

 I would appreciate very much..

 ___
 nginx mailing list
 nginx@nginx.org
 http://mailman.nginx.org/mailman/listinfo/nginx

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Re: How could I forbid outside visits without response 403

2014-06-13 Thread Jonathan Matthews
On 13 Jun 2014 15:15, 姚锟 627...@qq.com wrote:
 I think it still waste some resourses, RETURN A 403 STATIC PAGE..

I think you're probably wrong. You're almost certainly prematurely
optimising the wrong thing. Just 403 the unwanted requests and move on with
your job/life/project.

I mean this sincerely,
J
___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx

Re: How could I forbid outside visits without response 403

2014-06-13 Thread Steve Wilson

On 13/06/14 15:14, 姚锟 wrote:
 Hi Buddy,
 I am a newer to Nginx world, now I have a project to link the varnish
 HTTP server and nginx together, nginx is the back end.

 I want to allow the connections only by varnish, so I use deny all
 ,this kind of stuff to archieve this.

 But if there is a way to compeletely forbid the connections, at
 present, even the outside connections is forbidden, but I think it
 still waste some resourses, RETURN A 403 STATIC PAGE..

 I will not use a iptables..

If varnish and nginx are on the same machine, you could configure nginx
listen to listen on loopback (127.0.0.1:8080 say) and varnish to connect
to that ip:port. This will stop all external direct access to nginx.

I'm guessing you've some conditional check in nginx that's currently
denying external access, you could look at the 444 return code. A quick
google came up with
http://www.acloudtree.com/how-to-deny-hosts-using-nginx/

Steve.

___
nginx mailing list
nginx@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx