Articles of nginx

nginx – 位置下的owncloud

我想把我的默认虚拟主机的位置下的owncloud。 我也想redirect到https。 我已经得到它与phpmyadmin的工作,但我不能与owncloud。 这是build议的configuration文件formsowncloud.org server { listen 443 ssl; ssl_certificate /etc/ssl/localcerts/certificate.crt; ssl_certificate_key /etc/ssl/localcerts/privateKey.key; server_name cloud.technolust.info; root /var/www/owncloud; client_max_body_size 10G; # set max upload size fastcgi_buffers 64 4K; rewrite ^/caldav(.*)$ /remote.php/caldav$1 redirect; rewrite ^/carddav(.*)$ /remote.php/carddav$1 redirect; rewrite ^/webdav(.*)$ /remote.php/webdav$1 redirect; index index.php; error_page 403 = /core/templates/403.php; error_page 404 = /core/templates/404.php; location = /robots.txt { allow all; […]

NGINX:我可以使用proxy_pass指令使用上游服务器的映射吗?

我有一个NGINX服务器,作为一群后端IIS服务器的反向代理。 我希望将每个传入的HTTPS请求都传递给某个后端(上游)服务器,具体取决于指定的URI,同时在地址栏中保留相同的URL(以保证后端服务器名称或地址对用户不可见) 例如 地址栏请求看起来像: https://test.blahblah.com/url_a 实际上去 – > https://upstreamserver_a/url_a 但在地址栏中仍然是这样的: https://test.blahblah.com/url_a 这是我的nginx.conf到目前为止: ## Upstreamserver_A backend for test.blahblah.com upstream upstreamserver_a { server 10.10.1.12:80; #upstreamserver_a.blahblah.com } map_hash_bucket_size 128; map_hash_max_size 2048; # URI to Server Map map $1 $upstream_host { default whatever; url_a upstreamserver_a; } ## OUR HTTP SERVER AT PORT 80 server { listen 80; server_name test.blahblah.com; […]

Nginx + uwsgi … 502坏的网关

所以我试图用我的Django应用程序的uwsgi设置Nginx。 这是我的/etc/nginx/nginx.conf文件: # /etc/nginx/nginx.conf user richard richard; ## Default: nobody worker_processes 5; ## Default: 1 error_log /var/log/nginx/error.log; pid /var/log/nginx/nginx.pid; worker_rlimit_nofile 8192; events { worker_connections 4096; ## Default: 1024 } http { include /etc/nginx/mime.types; include /etc/nginx/proxy.conf; index index.html index.htm; default_type application/octet-stream; log_format main '$remote_addr – $remote_user [$time_local] $status ' '"$request" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "$http_x_forwarded_for"'; access_log […]

在NGiNX中重写文件扩展名

我正在寻找像domain.com/login而不是domain.com/login.php文件 我的NGiNX站点configuration是: #02API server { # listen 80 deferred; # for Linux # listen 80 accept_filter=httpready; # for FreeBSD listen 80; # The host name to respond to server_name api.api.com; # Path for static files root /app/api/api; # Try static files first, then php index index.html index.htm index.php; # Specific logs for this vhost access_log […]

Nginx不会cachingjson

我有以下nginxconfiguration user nginx; worker_processes 10; pid /var/run/nginx.pid; events { worker_connections 1000; } http { sendfile on; tcp_nopush on; tcp_nodelay on; keepalive_timeout 65; types_hash_max_size 2048; include /etc/nginx/mime.types; default_type application/octet-stream; ## # Logging Settings ## log_format log_cache [$time_local] $remote_addr " – " '"$request"' " – " $upstream_cache_status " " $request_time " – " $status " " $body_bytes_sent […]

nginx:fastcgi_cache_path为空

我想在我的nginx 1.5.8安装程序上尝试fastcgi_cache ,如下所示。 在nginx conf中,http部分,我补充道: fastcgi_cache_path /var/cache/nginx levels=1:2 keys_zone=microcache:10m max_size=1000m inactive=60m; 在服务器部分: set $cache_uri $request_uri; # POST requests and urls with a query string should always go to PHP if ($request_method = POST) { set $cache_uri 'null cache'; } if ($query_string != "") { set $cache_uri 'null cache'; } # Don't cache uris containing the […]

redirect不支持SSL cipers \套件的浏览器

我想将使用旧浏览器的客户端redirect到指示他们下载较新浏览器的页面。 我的意思是“旧”浏览器 – 不支持某些ciper套件\ ssl协议的浏览器。 例如TLS1.1或更高版本去old.html和TLS1.2去index.html 那可能吗?

在NGINXnetworking服务器上将有效的url格式列入白名单

我想只在我们的RESTfulnetworking服务器/ API,使用正则expression式或其他东西白名单有效的URL模式。 但是,当用googlesearch一些例子时,我有点怀疑,因为没有太多的文档。 这样做不常见吗? 在我看来,这是任何networking服务器脚本的一个非常重要的部分。 我在这里俯瞰什么? 🙂

如何拒绝所有子目录中的shell执行?

我希望nginx拒绝那些在/ webroot / uploads里面有文件夹的用户 例如 /webroot/uploads/user1 /webroot/uploads/user2 /webroot/uploads/user1000 执行任何shell(php,pl,exe)。 shell通常隐藏在jpg或gif文件中。 像badfile.php.jpg一样 我也看到茂盛的二进制文件被上传到文件夹。 这里我的初步规则是: location ~ /webroot/uploads/(.+)\.php$ { deny all; } location ~ /webroot/uploads/(.+)\.pl$ { deny all; } 但我不确定它是否健壮。 所以我感谢你的帮助。

如何在CentOS 6上添加模块到nginx

我有nginx 1.4.4作为反向代理和Apache作为后端。 我的问题是 – 如何添加模块到nginx? 我需要这个模块http://wiki.nginx.org/HttpUploadProgressModule 检查nginx -V我没有这个模块 我读到,我需要重新编译一个新的模块nginx。 怎么做? 如何保存旧的nginxconfiguration文件,所以我不会搞乱我的networking服务器?