在我的ToDo列表中从fcgiwrap迁移到uWSGI(这也带来了我计划使用的其他许多好处)之后,我终于设法build立了一个以uWSGI v2.0为特色的debian-wheezytesting系统, nginx v1.4.4。 在第一步中,我想通过uWSGI的cgi-plugin可靠地运行.cgi-scripts,并以最小的开销(相当弱的硬件),同时可以轻松地增强我的configuration,同时也可以通过框架部署应用程序,例如bottle / flask / django作为第二步。 所以我select了使用uWSGI的皇帝模式 ,这个模式目前只能控制一个configuration来运行uWSGI-cgi-plugin的两个工作者,每个工作者有两个线程。 检查出各种function之后,设置或多或less都可以正常运行了,但我觉得有两种奇怪的行为,我认为这些行为是错误的 : 一旦配件被configuration为向皇帝发送心跳(例如,通过向.ini添加heartbeat = 20 ),如果.cgi没有在定义的心跳时间内运行,则皇帝将重复杀死/重新生成附属的主人。 configuration的工人数量似乎并不重要。 这个vassal忽略了reload-mercy = 10这个选项,因为它仍然logging着your mercy for graceful operations on workers is 60 seconds (这是默认值)。 好吧,这只是一个小问题,与我无关。 使用心跳选项的原因是我想尽可能使用内置的uWSGI机制来保证我的cgis / apps的可用性。 任何提示我可能会误解或做错? 我看不出任何明显的原因,为什么不应该在我的configuration中将心跳选项与cgi-module结合使用,而是希望得到更进一步的了解! 我假设nginx与上述问题无关,另外我还仔细检查了文件和目录 – perms … uWSGI是通过init.d-script启动的,但是手动启动时的行为是一样的。 我的configuration如下: 在nginx.conf中的部分: location ~ ^/cgi-bin/.*\..+$ { root /usr/local/nginx/vhosts/testdomain.com/cgi-bin; gzip off; include uwsgi_params; uwsgi_modifier1 […]
我需要将Magentopipe理员从商店发送到单独的后端。 我有两个问题: 不知道如何正确匹配index.php /pipe理和/pipe理与正则expression式(index.php /pipe理工作,因为它是匹配第二个位置,我下面); 当我得到Nginx匹配的位置(目前只有/pipe理),我不知道如何正确转发请求,所以我从后端“文件未find”,因为它试图打开一个PHP文件,而不是发送到主处理程序index.php。 这是我目前pipe理的 location ~ ^/(admin|index.php/admin)/ { fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass server1:9000; #fastcgi_index index.php; include fastcgi_params; } 这是匹配index.php / admin和整个网站的第二个指令 location ~ \.php$ { try_files $uri =404; fastcgi_split_path_info ^(.+\.php)(/.+)$; fastcgi_pass server2:9000; fastcgi_index index.php; include fastcgi_params; }
我希望某些页面在https上可用,但不在http上。 我有一个Code Igniter框架。 这里是来自nginx conf的代码: server { listen 80; …… #enforce https if ($request_uri ~ "^(winkelmandje|(index.php/)?winkelmandje|(index.php/)?history|(index.php/)?mobile/winkelmandje|(index.php/)?winkelmandje/voegtoe)"){ rewrite ^/(.*)$ https://$http_host/$1 permanent; } …. } server { listen 443; ssl on; …. #enforce http if ($request_uri ~ "^(!(index.php/)?winkelmandje|!(index.php/)!mobile/winkelmandje|!(index.php/)?history|assets/|!lib_desktop/|!lib_mobile/|!images/|!widget/|!(index.php/)?winkelmandje/voegtoe)"){ rewrite ^/(.*)$ http://$http_host/$1 permanent; } ….. } 如果我去我的域名/ winkelmandje(这个页面是购物车)http上我不会redirect到https。 另一个例子是,如果我在https上访问域索引,我不会redirect到http
我有要求 /usr/share/nginx/www404 在我的NGINX日志中。 请注意,www和404被混合在一起。 在我的nginx.conf相应的行是 error_page 404 /404.html; 当然,我的网站根目录下有一个404.html。 在这里清理configuration文件(btw为什么这里很难把代码放在一个问题?): nginx.conf在这里: https : nginx.conf wordpress (在网站可用)在这里: https : //gist.github.com/panique/9003446 我的问题:为什么有这个奇怪的“位置”的请求,以及我的404错误configuration有什么问题?
我试图用php-fpm和mysqlconfigurationchroot。 我设法解决,但是当我试图达到除index.php以外的文件(如CSS,PNG等),它不断给404。 但是,当我禁用chroot时,它工作%100正确。 我的目录结构是这样的; /var/www #my chroot directory /var/www/tmp #related pid and sock files /var/www/log #related log directory /var/www/public_html #wordpress directory 而我的nginxconfiguration是这样的; server { listen 80; ## listen for ipv4; this line is default and implied root /public_html; index index.php; server_name _; location / { index index.php; } if (!-e $request_filename) { rewrite ^.*$ /index.php […]
我是configuration服务器的新手,我有问题让PHP使用我的django应用程序在nginx上使用UWSGI。 Django的伟大作品使用uwsgi和PHP伟大的时候,我删除了Django网站的conf,但是当我一起使用Django和PHP一起PHP文件不工作(浏览器只是下载它们),任何想法(请具体我是新来的东东)? 我接受build议,在这里变得有点绝望。 谢谢 这里是我的nginx的django站点conf文件: # mysite_nginx.conf #################### # the upstream component nginx needs to connect to upstream django { # server unix:///home/appdeploy/uwsgi-tutorial/mysite/mysite.sock; # for a file socket server 127.0.0.1:8001; # for a web port socket (we'll use this first) } # configuration of the server server { # the port your site will be […]
我目前有2个服务器容器,http为1,另一个为同一个服务器,但https。 我想用Listen 80;合并这些容器Listen 80; 和Listen 443 ssl; ,这工作,但我需要重写一个不同的URL: location ^~ /wp-admin { rewrite ^ https://domain.com$request_uri? permanent; } location ^~ /wp-login.php { rewrite ^ https://domain.com$request_uri? permanent; } 当HTTP和HTTPS结合使用时,会导致无限的位置循环。 我需要改变模式,但我没有得到它的工作: location ~ ^http://domain\.com/wp-admin { rewrite ^ https://domain.com$request_uri? permanent; } location ~ ^http://domain\.com/wp-login.php { rewrite ^ https://domain.com$request_uri? permanent; } 这不行,有人知道吗?
我正在尝试为在本地主机上运行的Webpipe理控制台创buildSSL代理,并且没有SSL支持。 这是我的configuration: server { listen 111.222.1.1:8443 ssl; server_name admin.company.com; ssl_certificate tls/ssl.crt; ssl_certificate_key tls/ssl.key; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_hide_header X-Powered-By; #error_page 497 https://admin.company.com:8443$request_uri; location / { proxy_pass http://127.0.0.1:8080/; } } 代理服务相当复杂,并使用大量的Post / Redirect / Get操作,networking监视器显示它们都涉及“http://admin.company.com:8443”,从而导致该主题。 添加error_page 497 (注释掉)解决了GET和redirect,但是使POST不可能。 有没有解决scheme,一个IP和一个端口configuration,这将代理GET和POST请求? UPD:代理后面的应用程序是一个运行在不安全模式下的Java servlet,所以我相信这是“http”的来源,它只需要代理主机名,并用明确设置的“http”来构buildURL。
我努力让我的代码在nginx上工作。 这个configuration适用于lighttpd,但是我想把它迁移到nginx。 在lighttd上重写规则: url.rewrite-once = ( "^/(ui)/(.*)$" => "/gi.php/$1/$2", "/(.*)\.(.*)" => "$0", "/(xhr|js-api)/(.*)" => "$0", "^/([^.]+)$" => "/gi.php/$1" ) 任何人都可以帮助在这个转换? 我尝试了很多东西,包括将其转换为Apache重写规则,但没有一个工作。 Nginx规则: if (!-f $request_filename){ set $rule_0 1$rule_0; } if (!-d $request_filename){ set $rule_0 2$rule_0; } if ($rule_0 = "21"){ rewrite ^/(.*)$ /gi.php/$1 last; } Error : 404 有什么build议么?
我的印象是,在debian上安装nginx会为我创build这两个目录: 在/ etc / nginx的/网站可用/ 启用站点的/ etc / nginx的/ / 这是不是自动创build的,是否正确,我应该手动创build这些,并把我的conf文件在那里读取?