我有一个index.html页面与其余的客户端资源( /opt/django/media/index.html )一起存储。 我可以让nginx将页面作为请求的索引提供给域名,但是它的作用就好像它位于项目根目录下,而不是在媒体目录中。 这意味着像images/123.png的页面中可以访问的images/123.png现在必须通过index.html中的media/images/123.png 。 我应该只更新页面中的资源path还是有更好的方法呢? 我的configuration如下: server { listen 80; server_name localhost; access_log /opt/django/logs/nginx/vc_access.log; error_log /opt/django/logs/nginx/vc_error.log; # no security problem here, since / is alway passed to upstream root /opt/django/; location = / { index media/index.html; } # serve directly – analogous for static/staticfiles location /media/ { # if asset versioning is used […]
可能重复: 需要自定义Nginx的正则expression式 期望的结果是这样的: http://www.example.com/about/?r=something 对此: http://www.example.com/about.php/?r=something 这是我得到的,但它不工作: if (!-e $request_filename) { rewrite ^/([^?]*[^?/])/?(\?.*)?$ /$1.php/$2 last; break; } 我在这里做错了什么?
我使用elb终止ssl。 我想强制/产品/ performanceummaries /仅为HTTP。 这是我现在正在玩的configuration: user www-data; worker_processes 2; pid /var/run/nginx.pid; events { worker_connections 1024; # multi_accept on; } http { ## # Basic Settings ## sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; # server_tokens off; # server_names_hash_bucket_size 64; # server_name_in_redirect off; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## access_log […]
我正在尝试使用nginx安全链接模块,但是允许我自己绕过对本地IP的散列检查。 我不知道如何去做,这是我迄今为止: location /secured/ { secure_link $arg_st,$arg_e; secure_link_md5 <redacted>$uri$arg_e$remote_addr; sendfile on; tcp_nopush on; alias /srv/http/jmsdirectory/public_html/media/secured/; if ($secure_link = "0") { rewrite . /media/expired.html last; } if ($secure_link = "") { rewrite . /media/bad_hash.html last; } }
我们渴望使用基于django的应用程序的nginx + uwsgi,因为我们想尝试更新的解决scheme,并且听说nginx比apacheless资源密集型。 在从Django的创build者之一读到关于Quora上的apache的一些观点之后: http://www.quora.com/What-web-server-suits-Django-best I'm still a big fan of a stripped down Apache+mod_wsgi running behind nginx. Nginx handles static files, gzip, trickling to slow clients, load balancing and having a configuration language that's actually pleasant to work with. Apache just sits there serving up dynamic Python pages via mod_wsgi, using the shortest possible […]
使用Nginx 1.1.19和PHP 5的Web服务器FPM可以很好地服务于PHP并显示mysql数据的输出。 我想在我的应用程序中embeddednagios,所以我第一次在这台服务器上需要.cgi脚本。 这没有奏效。 然后,我做了一个简单的echo hello world .cgi脚本,我仍然得到“访问被拒绝”。 我给了文件和它上面的所有文件夹执行权限(chmod + x)
我遇到了Nginx的奇怪行为。 在我的例子中,Nginx作为Jetty的代理。 configuration如下: server { listen 80; client_header_timeout 3m; client_body_timeout 3m; send_timeout 3m; client_max_body_size 5M; server_name test.com www.test.com location / { auth_basic "Restricted area"; auth_basic_user_file /etc/nginx/htpasswd; proxy_pass http://localhost:8080; 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 http; proxy_set_header X-Real-IP $remote_addr; proxy_set_header Host $http_host; gzip on; } } 当上传大小超过5M的文件时,我会收到'网关超时'。 CPU使用率为0%。 我不知道什么是错的。 这与networking速度无关,因为我正在本地进行testing。 如果我跳过一个代理,并尝试直接上传文件到应用服务器(我的意思是:在端口8080),一切都像一个魅力。 任何想法 ?? 问候!
我试图让Nginx运行一些正则expression式的请求,并将它们发送到另一个服务器块,从第二个服务器块返回响应头。 此刻,我得到了302响应状态,如何从第二个服务器块获取标题? 所以作为一个例子,我想要一个请求,如: http://nginxrouting.local/some/stuff/that/needs/to/be/removed/itemid=1234/more/stuff/topicid=1234发送到http ://nginxrouting_destination.local/itemid=1234topicid=1234从新位置返回标题 服务器块如下所示: server { server_name nginxrouting.local; root /var/nginxrouting/public; location / { if ($request_uri ~* ".*(itemid=[0-9]*){1}.*") { set $itemid $1; } if ($request_uri ~* ".*(topicid=[0-9]*){1}.*") { set $topicid $1; } if ($request_uri ~* ".*(&type=RESOURCES){1}.*") { set $resources $1; } rewrite ^ http://nginxrouting_destination.local/$itemid$topicid$resources? redirect; add_header itemid $itemid; } } server { server_name nginxrouting_destination.local; […]
我必须在centos 6.3机器上设置Kayako服务器..我用php5.3和其他所需的东西安装nginx,一切正常。 所以我复制了kayako文件到: /var/www/nginx-default/kayako/setup 并编辑我的虚拟主机为(完整文件): server { listen 80; server_name XXX.XXX.com; location /kayako { root /var/www/nginx-default/; index index.php; } } 然后,当我使用浏览器打我的域名: http : //XXX.XXX.com/kayako/setup/它开始下载文件名称“downlaod”,并不显示任何内容。 和我的错误日志文件是空白.. 请告诉我发生了什么问题? vi nginx.conf: user nginx; worker_processes 4; 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 { worker_connections 1024; } http { include /etc/nginx/mime.types; default_type application/octet-stream; log_format main […]
ive按照这里的指令在子域上安装了redmine> http://library.linode.com/web-applications/project-management/redmine/ubuntu-10.04-lucid它实际上并没有工作,但另一个故事。 我主要关心的是任何时候我去anything.domain.com我被定向到相同的事情,(redmine / nginx)。 什么抛出我是如果我有一个子域运行/用virtualmin创build,这工作正常。 它似乎只是端口8080是一个catchall,我更喜欢catchall是端口80的Apache,所以它可以说“你没有权限”。 这里是我的虚拟主机(我也使用localhost:8080而不是域名,似乎没有区别。 <VirtualHost 50.116.11.1:80> ServerAdmin [email protected] ServerName proj.domain.com ProxyPass / http://proj.domain.com:8080/ ProxyPassReverse / http://proj.domain.com:8080/ # Uncomment the line below if your site uses SSL. SSLProxyEngine On </VirtualHost> 或者也许即时通讯在错误的地方做这个? 谢谢!