我有一个服务器,将有2个不同types/格式的请求进来。两个请求的URL将开始: http://myredirect.mycompany.com/browse/ : http://myredirect.mycompany.com/browse/ 。 在'/ browse /'之后,它将是一个数字: http://myredirect.mycompany.com/browse/12345, it can be any number 或者它将是2到4个大写字母,后跟一个“ – ”,后跟一个数字: http://myredirect.mycompany.com/browse/QA-12345 我想要做的redirect到一个基于传入URL的不同的URL。 例如: http://myredirect.mycompany.com/browse/12345 would redirect to http://serverA.mycompany.com/show_item.cgi?12345 和 http://myredirect.mycompany.com/browse/QA-12345 would redirect to http://serverB.mycompany.com/browse/QA-12345 我想我想要的是使用nginx重写,但我不知道如何形成。 从我googlesearch,你可以使用正则expression式重写,所以我可以使用类似的东西 ^(/browse/[0-9])? 为第一个。 但是,我怎么才能真正把这个号码拉到redirecturl? 谢谢!
我有一个在JBoss服务器上运行的应用程序。 另外我有nginx作为这个应用程序的反向代理服务器。 现在我想configurationssl。 我必须在两台服务器上进行configuration吗? JKS的JBoss和CTR,Nginx的关键?
在一个小团队(最多30人)的服务器上,我安装了几个可以从浏览器访问的服务。 我想用nginx,因为我认为它更轻量级。 所有的服务/应用程序都是独立testing,并完成他们的工作。 但是当把它们放在一起被子文件夹(比如teamserver.local / service1,或者teamserver.local / service2)分开的时候,在重写规则和代理传递的时候,我感到非常挣扎。 我只是不能让子文件夹configuration工作。 这是我的默认configuration: server { listen 80; server_name teamserver.local; rewrite ^ https://$http_host$request_uri? permanent; # redirect to https! } server { listen 443; server_name teamserver.local; root /var/www; ssl on; ssl_certificate /etc/nginx/ssl/server.crt; ssl_certificate_key /etc/nginx/ssl/server.key; ssl_session_timeout 5m; ssl_protocols SSLv3 TLSv1 TLSv1.1 TLSv1.2; ssl_ciphers "HIGH:!aNULL:!MD5 or HIGH:!aNULL:!MD5:!3DES"; ssl_prefer_server_ciphers on; location /service1 { […]
我正在考虑使用下面的nginx模板的WP网站与他们的AdSense。 会caching的AdSense广告,并使点击无效? server { listen %ip%:%proxy_port%; server_name %domain_idn% %alias_idn%; error_log /var/log/%web_system%/domains/%domain%.error.log error; location / { proxy_pass http://%ip%:%web_port%; proxy_cache cache; proxy_cache_valid 15m; proxy_cache_valid 404 1m; proxy_no_cache $no_cache; proxy_cache_bypass $no_cache; proxy_cache_bypass $cookie_session $http_x_update; location ~* ^.+\.(%proxy_extentions%)$ { proxy_cache off; root %docroot%; access_log /var/log/%web_system%/domains/%domain%.log combined; access_log /var/log/%web_system%/domains/%domain%.bytes bytes; expires max; try_files $uri @fallback; } } location /error/ { […]
我是nginx的新手。 我的机器是4个CPU和8 GB的RAM的6个内存。 按照我的build议 worker_process = 4.我已经为2000个最大客户端设置了worker_connections为500,但是平均负载达到了3-4,有时甚至达到了7,只有大约150个连接。有时会导致504网关超时问题。 每个php-fpm进程的平均CPU利用率是10到15%,有时达到30%,内存利用率是0.1%到0.5% 我应该为worker_connections设置什么样的最佳值,以及如何根据cpu利用率来计算我的最大客户端值。
现在在我的访问日志文件中logging的logging太多, – 因为图像和页面在同一个文件中。 是否有可能将所有图像移动到一个文件,只有PHP页面到第二个文件? (过滤图像和非图像文件) server { root /home/nginx/site; index index.html index.htm index.php; access_log /home/nginx/site/_log/site_access.log; error_log /home/nginx/site/_log/site_error.log; listen 80; keepalive_timeout 70; location / { # First attempt to serve request as file, then # as directory, then fall back to index.html try_files $uri $uri/ /index.html; } include /etc/nginx/server.conf.d/php.conf; }
我在我的uWSGI日志中获得了以下回溯,我不知道从哪里开始寻找解决办法: DAMN ! worker 5 (pid: 29056) died 🙁 trying respawn … Respawned uWSGI worker 5 (new pid: 29088) DAMN ! worker 6 (pid: 29080) died 🙁 trying respawn … Respawned uWSGI worker 6 (new pid: 29089) !!! uWSGI process 29089 got Segmentation Fault !!! *** backtrace of 29089 *** uwsgi(uwsgi_backtrace+0x2e) [0x468a9e] uwsgi(uwsgi_segfault+0x21) [0x468e61] /lib/x86_64-linux-gnu/libc.so.6(+0x36d40) […]
我有一个rails应用程序和一个基于wordpress的cms在另一台服务器上。 我试图在同一个域名下托pipe他们。 我希望所有非cmsstream量redirect到https。 并且所有/ cms /stream量应该去http和代理到wordpress服务器。 但/ cms /目录无法循环。 我已经尝试了很多方法,无法解决问题。 你能找出这个nginxconfiguration上的问题吗? upstream example { server unix:/tmp/unicorn.example.sock fail_timeout=0; } server { listen 80; server_name www.example.com example.com; root /home/deployer/apps/example/current/public; set $redirect true; if ($request_uri ~ ^/cms/(/.*)$) { set $redirect false; } location /cms/ { proxy_pass http://cms.example.com:80/; proxy_set_header Host cms.example.com; 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 […]
当我尝试在Ubuntu + Nginx服务器上加载我的Laravel应用程序时,我一直在碰到这个错误。 用户应该访问app.example.com/my-app ,它应该加载/var/www/app/my-app/public/index.php的内容 [错误] 9028#0:* 15001禁止“/ var / www / app / my-app /”目录索引,客户端:xxx.xxx.xxx.xx,server:app.example.com,request:“GET / my-app / HTTP / 1.1“,主机:”app.example.com“ 我的nginxconfiguration如下: server { server_name app.example.com www.app.example.com; root /var/www/app; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php?q=$uri&$args; } location ~ \.php$ { #fastcgi_pass unix:/dev/shm/php-fpm-www.sock; fastcgi_pass 127.0.0.1:7777; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; […]
我正在尝试启动我的nginx服务器。 当我键入$> /etc/init.d/nginx start ,我有一条消息出现“Starting nginx:Ok”,然后没有任何反应。 当我inputsudo lsof -nP -i | grep LISTEN sudo lsof -nP -i | grep LISTEN ,我没有用nginx(端口80) 我的error.log文件是空的。 我没有任何想法。 请帮帮我。 Nginx的版本:nginx / 1.4.6(Ubuntu) 这是我的/etc/nginx/nginx.conf文件: worker_processes 1; events { worker_connections 1024; } http { server_names_hash_bucket_size 64; include mime.types; default_type application/octet-stream; sendfile on; keepalive_timeout 65; #gzip on; gzip on; gzip_http_version 1.0; gzip_comp_level 2; […]