我试图启用我的内容服务器上的mp4stream式传输。 由于一些安全狂热分子,我与所有文件工作通过一个PHP脚本交付,并具有以下url格式: http://server.com/cdn/3/getObject?param1=71¶m2=1002&file=File1000.mp4 因此,所有标准格式的stream式处理请求(例如下面的url)都会由于附加的参数而失败 http://server.com/cdn/3/getObject?param1=71¶m2=1002&file=File1000.mp4?start=10.0 目前我正在运行nginx,编译并运行mp4stream模块。 我正在考虑做一个URL重写,以启用stream式传输,但我迄今没有成功。 除此之外,我将不得不在下一步中启用安全stream式传输。 任何帮助将不胜感激。 更新: 看来我的问题还不够清楚。 我不想使用PHP脚本或任何stream来传输我的mp4文件。 我的问题是使用PHP脚本来确定文件的path,这是因为我需要确保人们不能猜测其他的URL。 所以如果所有其他参数都适合,getObject脚本只是返回所请求的文件而不做任何修改。 现在的问题是,这使得不可能stream式传输文件。 任何尝试传输mp4文件(例如,使用stream式播放器)都会失败,即使启用了stream模块。
在我的PHP应用程序中: die($_SERVER['SERVER_NAME']); 请求: sub1.example.com 结果: example.com 我的NGINXconfiguration: server { server_name .example.com; access_log /var/log/nginx/example.com.access.log; error_log /var/log/nginx/example.com.error.log; root /var/www/html/example; index index.php; location ~ \.php$ { if (-f $request_filename) { fastcgi_pass 127.0.0.1:9000; } fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } location / { if ($request_filename ~ /sub1) { rewrite ^ http://sub1.example.com/? permanent; } if ($request_filename ~ /sub2) […]
我想要使用不同的位置块来运行多个rails应用程序。 不同的独angular兽工作者被启动和configuration,他们工作得很好。 每个应用程序都在同一个文件夹下: /var/www/<app> ,所以我像这样configuration了nginx: root /var/www; location /app1/ { root /var/www/app1/public; try_files $uri/index.html $uri.html $uri @app1; } location /app2/ { root /var/www/app2/public; try_files $uri/index.html $uri.html $uri @app2; } 我的问题是,这个规则集请求(像mydomain / app1 /检查)进入我的app1像这样: Started GET "/app1/check" for …我想刚刚Started GET "/check" for … 我应该改变我的configuration?
在FreeBSD 8.3上从端口安装Nginx之后,/ usr / local / etc / nginx里的configuration文件都有只读权限。 是否有一个原因? 我不应该编辑它们吗? 或者我可以放心地忽略这个事实并修改它们?
我目前在标准文件path中有2个服务器块的nginxconfiguration文件: /usr/local/etc/nginx/nginx.conf /usr/local/etc/nginx/sites-available/one.website.com /usr/local/etc/nginx/sites-available/two.website.com nginx.conf包含/usr/local/etc/nginx/sites-enabled/*中的所有文件,这些文件与sites-available文件夹中的两个网站有符号链接。 这两个网站都提供PHP文件,两个configuration文件之间的唯一区别是 server_name access_log error_log root fastcgi_param PHP_VALUE "error_log=… 巩固两个网站configuration文件的最佳做法是什么? 这里是其中一个完整的configuration(请注意,设置PHP error_log值与nginx error_log ): server { listen 80; server_name one.website.com; access_log /usr/local/var/log/one.website.com-access.log; error_log /usr/local/var/log/one.website.com-error.log; root /Users/hobbes3/Scripts/Neadwerx/one.website.com; location / { index index.html index.htm index.php; autoindex on; } # Disable favicon.ico logging location = /favicon.ico { log_not_found off; access_log off; } # Enable […]
我有以下情况: 在同一台机器上,我有一个mercurial服务器和一个web服务器。 项目库位于/ var / hg / repos / myproyect,Web服务器的公共文件位于/ usr / share / nginx / www 有什么方法可以将(ln)repo目录链接到公共path服务器? 当我做 ln /var/hg/repos/myproject/.hg/store/data/ /ush/share/nginx/www/myproject 而我把浏览器放在http://iptoserver.com/myproject中什么也没有显示 我注意到以.i扩展名结尾的.hg存储数据
我有一个别名“/ temp”工作正常,但是当我添加另一个位置块,别名返回404。 工作configuration: http://mysite.com/temp/blank.gif -> OK : http://mysite.com/temp/blank.gif -> OK server { # … location /temp { alias /var/www/temp; } # … } 错误configuration: http://mysite.com/temp/blank.gif -> 404 : http://mysite.com/temp/blank.gif -> 404 server { # … location /temp { alias /var/www/temp; } location ~ \.(?:jpg|png|gif)$ { expires 30d; } # … } 这是我的完整configuration: http : //pastebin.com/yExq0nMY […]
我正在尝试从Apache迁移到nginx。 在我的Apacheconfiguration文件中 php_value include_path "/home/my-app/topincs/php:/home/my-app/topincs/vendor/php" 现在我得到了 fastcgi_param PHP_VALUE "include_path=/home/my-app/topincs/php:/home/my-app/topincs/vendor/php"; 在我的nginx的fastcgi_params文件中,但似乎包含path不被php-fm使用,因为我得到以下错误。 PHP message: PHP Warning: require_once(Response.php): failed to open stream: No such file or directory in /home/my-app/topincs/docroot/.start on line 3 而文件Response.php确实存在于/home/my-app/topincs/php 。 我应该如何设置,以便php-fpm识别它?
我需要configurationnginx + gunicorn才能够在两个服务器上传大于默认最大大小的文件。 我的nginx .conf文件如下所示: server { # … location / { proxy_pass_header Server; proxy_set_header Host $http_host; proxy_redirect off; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Scheme $scheme; proxy_connect_timeout 60; proxy_pass http://localhost:8000/; } } 这个想法是允许两个地点20M的请求: /admin/path/to/upload?param=value /installer/other/path/to/upload?param=value 我已经尝试添加location指令在相同的水平比我在这里粘贴(获得404错误),也试图将它们添加到location /指令(获得413 Entity Too Large错误)。 我的位置指令看起来像这些最简单的forms: location /admin/path/to/upload/ { client_max_body_size 20M; } location /installer/other/path/to/upload/ { client_max_body_size 20M; } 但他们不工作(实际上我testing了很多组合,我绝望地想着这个。 请帮助如果可以的话:我需要设置哪些设置才能使其工作? 非常感谢!
我试图根据主机名转发SSL请求到我的机器上运行的子守护进程。 为了实现这样的行为,我试着用nginx做试验,然后nginx会作为一个反向代理/路由器。 我的configuration文件: # … location / { proxy_set_header Host $http_host; if ($host = 'hostname01.example.com') { proxy_pass https://127.0.0.1:8001; } if ($host = 'hostname02.example.com') { proxy_pass https://127.0.0.1:8002; } if ($host = 'hostname03.example.com') { proxy_pass https://127.0.0.1:8003; } if ($host = 'hostname04.example.com') { proxy_pass https://127.0.0.1:8004; } if ($host = 'hostname01.example1.com') { proxy_pass https://127.0.0.1:8005; } if ($host = 'hostname01.example2.com') […]