我正在尝试一些我认为相当简单的事情:即将domain.com/dashboard/redirect到另一个(不同的)应用程序,而不是我的主域(这是一个WordPress的安装,但这是相当不相关的,我认为)。 所以当访问domain.com/dashboard/anywhere ,这个第二个应用程序应该像if /dashboard/是域的路由一样,正常处理所有的URL。 我到目前为止所尝试的或者只是导致一个redirect循环,根本没有路由或者给出500错误。 这是迄今为止我的nginx位置的一个例子: location ~ ^/dashboard/ { alias /srv/www/htdocs/fork/; // this is the second application I want to access rewrite "^(/.*)$" http://domain.com/$1 permanent; index index.php index.html; include /etc/nginx/fastcgi_params; fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root/$fastcgi_script_name; break; } 我试过从alias切换到root ,但无济于事。 而且我不确定接下来要做什么。 有没有人有任何想法可能会导致redirect? (主要是造成domain.com/dashboard/dashboard/dashboard (等)的循环。 更新 好的,下面马克的build议,我已经移动位置块超过任何WordPress的规则,我已经注释了一些代码。 已经取得了进展,现在向domain.com/dashboard/的请求将访问正确的应用程序,但现在正在该应用程序中查找dashboard文件夹。 这是当前的代码: location ~ ^/dashboard(/)(.*)$ { root […]
我试图让本地主机上的Debian Jessie系统上运行的Zurmo CRM。 我无法find一个例子nginxconfiguration和应用程序需要重写URLS,我做错了。 我也使用重写在Drupal,我认为这是Nginxconfiguration将工作,但没有运气。 server { server_name zurmo; listen 80; root /var/www/sites/zurmo; index index.php; location = / { root /var/www/sites/zurmo; index index.php; } location / { root /var/www/sites/zurmo; index index.php; if (!-f $request_filename) { rewrite ^(.*)$ /index.php/$1 last; break; } if (!-d $request_filename) { rewrite ^(.*)$ /index.php/$1 last; break; } } location ~ ^/(protected|framework|themes/\w+/views) […]
以下是我的服务器块。 我正在使用客户端证书来控制对web服务的访问。 一切工作正常,如果我访问该服务为https://domain.com/TEST 。 但是,如果我尝试访问为https://xxx.x.xx.xxx/TEST (即使用IP地址,而不是域mame),我得到一个错误,说:“所需的SSL证书没有发送”即使我发送完全相同证书。 我的configuration有什么问题? server { listen 443; ## listen for ipv4; this line is default and implied #listen [::]:80 default ipv6only=on; ## listen for ipv6 server_name xxx.x.xx.xxx www.domain.com domain.com; access_log /usr/www/domain/logs/access.log; error_log /usr/www/domain/logs/error.log; ssl on; ssl_certificate /opt/nginx/ssl/server.crt; ssl_certificate_key /opt/nginx/ssl/server.key; ssl_client_certificate /opt/nginx/ssl/cacert.pem; ssl_verify_client on; ssl_session_timeout 5m; ssl_protocols SSLv3 TLSv1; ssl_ciphers ALL:!ADH:!EXPORT56:RC4+RSA:+HIGH:+MEDIUM:+LOW:+SSLv3:+EXP; ssl_prefer_server_ciphers […]
我有以下的Nginxconfiguration: http { … proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=one:8m max_size=3000m inactive=600m; proxy_temp_path /var/tmp; … upstream webhook_staging { server 127.0.0.1:4001; keepalive 64; } location /webhooks/incoming_mails { client_max_body_size 60m; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $remote_addr; proxy_set_header X-Forwarded-Proto $scheme; proxy_set_header Host $http_host; proxy_set_header Connection ""; proxy_http_version 1.1; # Does not work for HEAD requests #>> proxy_cache one; #>> proxy_cache_key […]
我得到了这个Flask应用程序,我在这个共享服务器上用127.0.0.1:5002上的gunicorn运行。 我有一个自己的nginx实例,我可以添加自定义configuration。 nginx目录的结构是这样的: ~/.nginx | conf.d | nginx.conf | […] 其中nginx.conf包含以下内容: pid /media/sdl1/home/USERNAME/.nginx/pid; error_log /media/sdl1/home/USERNAME/.nginx/error.log; worker_processes 1; worker_rlimit_nofile 65535; events { worker_connections 8192; } http { include /etc/nginx/mime.types; default_type application/octet-stream; access_log off; sendfile on; tcp_nopush on; real_ip_header X-Forwarded-For; client_max_body_size 1g; client_body_temp_path /media/sdl1/home/USERNAME/.nginx/client; fastcgi_temp_path /media/sdl1/home/USERNAME/.nginx/fastcgi; uwsgi_temp_path /media/sdl1/home/USERNAME/.nginx/uwscgi; scgi_temp_path /media/sdl1/home/USERNAME/.nginx/scgi; include conf.d/*.conf; } 现在指向conf.d目录,其中包含一个名为000-default-server.conf的文件和一个名为000-default-server.d的空目录 000-default-server.conf包含这个: server { […]
如何使这样的事情可能? location /download/ { limit_conn addr 2; if ($arg_C) { limit_conn addr 1; } } 给我: Restarting nginx: nginx: [emerg] "limit_conn" directive is not allowed here in /etc/nginx/sites-enabled/www.mypage.com:60
您好,我犯了php脚本subverison麻烦。 我正在使用Nginx的Web服务器发送请求到Apache服务器使用mod_proxy设置nginx的提交文件,svn结帐和更新工作正常。 服务器{ 听80; server_name svn.server; 位置 / { access_logclosures; proxy_pass http:// localhost:8081; proxy_set_header X-Real-IP $ remote_addr; proxy_set_header主机$主机; proxy_set_header X-Forwarded-For $ proxy_add_x_forwarded_for; } 位置〜^ / repos /.*。php $ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; 包括fastcgi_params; } }
由于BREACH漏洞,我希望为TLSstream量禁用gzip压缩,但对于常规HTTPstream量则不能。 我可以将每个Nginx server部分分成两个单独的TLS和非TLS部分,并在那里configurationgzip,但是在同一个web服务器上运行的十几个站点中,我不希望每个服务器部分都这样做。 是否可以禁用所有HTTPS请求的gzip压缩,而不创build多个server部分(例如从http部分)?
问题 我试图拒绝访问我的web根目录中的两个文件,update.php,install.php,并要求对apc.php(也是webroot)进行身份validation。 我想我已经成功地拒绝访问,但打开文件下载而不是运行。 例如,inputIPADDRESS / apc.php的authentication后,下载到我的电脑而不是打开。 同样的事情发生的update.php。 如果我删除引用这三个文件的块,它会成功,但当然,他们不被阻止。 我怎样才能解决这个问题? 至今 (我已经重新安排把相关的块带到最上面。) 我认为问题是这样的: 我唯一能find的位置匹配是^〜,所有其他的都被忽略(为什么?),expression式^〜匹配后停止search,所以我认为它从来没有findPHP块。 所以它下载而不是运行。 我试图添加phpconfiguration给块: location ^~ /update.php { allow 127.0.0.1; deny all; fastcgi_param SCRIPT_FILENAME /srv/www/mysite/public$fastcgi_script_name; fastcgi_pass 127.0.0.1:9000; include /etc/nginx/fastcgi_params; } 但这只是使页面变成空白。 服务器configuration server { listen 8080; server_name website website.com; access_log /srv/www/website/logs/access.log; error_log /srv/www/website/logs/error.log; root /srv/www/website/public; location / { index index.php index.html index.htm; error_page 404 […]
我想限制使用Nginx网站的带宽,以便在多个网站之间分享,就像我能够在IIS7中做的那样。 从阅读文档,我发现我需要使用 http { } limit_req_zone , 但是,所有的例子都是限制请求速率而不是带宽,他们使用$binary_remote_addr ,我想我应该使用$host来代替, zone=NAME:value ,这个部分没问题。 示例在最后使用“rate = value”,但我不想限制网站的连接速度,我想限制带宽,我可以用limit_rate=valuereplace它吗? 一旦区域设置,我想我只需要在正确的地方使用limit_req 。