我在nginx服务器上遇到了laravel的路由问题。 它显示了一个“404找不到”的所有路线,除了默认的,非常类似于这个问题: https : //stackoverflow.com/questions/21091405/nginx-configuration-for-laravel-4 解决这个问题的方法: 服务器{ 听80; server_name sub.domain.com; 设置$ root_path'/ srv / www / htdocs / application_name / public'; root $ root_path; index index.php index.html index.htm; try_files $ uri $ uri / @rewrite; 位置@rewrite { 重写^ /(。*)$ /index.php?_url=/$1; } 位置〜\ .php { fastcgi_pass 127.0.0.1:9000; fastcgi_index /index.php; 包括/ etc / nginx / fastcgi_params; fastcgi_split_path_info […]
我试图保护mp4文件的hotlink,但不适合我。 这是我正在使用的代码: location ~* \.(gif|jpg|jpeg|png|wmv|avi|mpg|mpeg|mp4|htm|html|js|css)$ { valid_referers none blocked http://188.226.192.56; if ($invalid_referer) { return 403; } root /usr/share/nginx/html; expires 1d; } 适用于.jpg,.png等,但不适用于mp4。 我究竟做错了什么? 这是我的nginx conf: server { listen 80; server_name ipaddress; #charset koi8-r; #access_log logs/host.access.log main; location / { root /usr/share/nginx/html; index index index.php index.html index.htm; } error_page 404 /404.html; location = /404.html { root […]
试图了解如何强制www。 在我的域名并redirect像ww.example.com或test.example.com – > www.example.com 一切正常,当我去www.example.com或example.com,我只是试图掩盖自己,如果人们尝试去错误的领域,我不应该添加任何比'www.example.com'和' example.com'在我的django ALLOWED_HOSTS 我把所有东西都按照: 如何使用Django的一键安装图像 upstream app_server { server 127.0.0.1:9000 fail_timeout=0; } server { listen 80 default_server; listen [::]:80 default_server ipv6only=on; root /usr/share/nginx/html; index index.html index.htm; client_max_body_size 4G; server_name _; keepalive_timeout 5; # Your Django project's media files – amend as required location /media { alias /home/django/django_project/django_project/media; } # your […]
我想configuration一个能够托pipe多个网站的NGINX服务器,这个网站是相互独立的,所以vhosta不能从vhostb访问文件。 我安装了一个新的Debian 7.5服务器,并从默认的debian软件包中安装了NGINX和PHP FPM。 然后,我将添加2个新用户vhosta和vhostb ,并将NGINX web服务器用户www-data到每个用户的组中。 接下来我创build了以下目录结构。 var/ |—www/ |—vhosta |—httpdocs (permissions 750 – owner: vhosta – group: vhosta) |—vhostb |—httpdocs (permissions 750 – owner: vhostb – group: vhostb) 我为每个虚拟主机configuration了一个单独的PHP FPM池,以便为每个虚拟主机分离PHP进程。 configuration如下(只显示vhosta ) [vhosta] listen = /var/run/php5-fpm-vhosta.sock user = vhosta group = vhosta listen.owner = vhosta listen.group = vhosta 据我所知,这个configuration应该单独访问vhostb's httpdocs目录中的文件,因为vhosta没有从vhosta的httpdocs文件夹的访问权限。 我validation了这一点,试图在vhosta创build一个简单的PHP脚本,该脚本尝试访问vhostb's httpdocs目录中的文件。 到现在为止还挺好。 […]
我正在使用nginx版本1.4.6。 我无法使map工作。 我有这样的东西: http { map $arg_f $forum { default 0; 1 2; } # … server { # … location = /old.php { if ($forum) { return 301 /forums/$forum/; } return 494; } # … } # … } 下面是我用nginx -t获得的nginx -t : nginx: [emerg] unknown "forum" variable 目标是将旧的URI映射到新的URI。 问题是一些数字论坛ID已经改变了。 我想在Nginx中处理这个,所以如果没有其他简单的方法,我愿意诉诸lua。 只要他们优雅,我可以select其他的解决scheme,但我想知道为什么map不在这里工作。 是否因为重写模块不查询地图,至less在1.4?
最近我重新安装了Ubuntu 14.04 LTS,nginx / 1.6.1和php5-fpm的服务器。 当我尝试访问index.html它正在工作,当我尝试访问index.php我得到“404未find”。 我再次检查.conf文件,我无法find问题。 server { listen myip:80; server_name www.example.com; rewrite ^(.*) http:// example.com$1 permanent; } server { listen myip:80; server_name example.com; root /var/www; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.html; } access_log off; error_log /var/www/error.log; rewrite_log on; error_page 403 404 /404.html; error_page 500 502 503 504 /404.html; […]
我们有一个原型设置,Nginx作为负载均衡器SSL终结器。 Nginx的背后是GlassFish 3,通过HTTP(无SSL)运行我们的REST Web服务以及其他应用程序服务器。 所有对https://api.example.com的请求都被redirect到GlassFish。 现在这个服务器运行在同一台服务器上,所以我们不需要担心太多的安全问题(GlassFish的应用程序端口被阻止进行远程访问)。 但是,我们需要尽快扩展,负载平衡器(Nginx或其他)将需要移到另一台服务器。 我没有很多经验设置SSL证书,所以我想知道我们的select是什么: 我们是否应该为GlassFish服务器安装SSL证书(可能是自签名证书)以确保在通过负载均衡器之后进行SSL / TLS连接? Nginx有一个* .example.com SSL证书。 我们是否可以使用与两个不同的Web服务器相同的SSL证书,所以Glassfish可以直接接收到一个子域( https://api.example.com )的HTTPS请求,而不需要通过Nginx或任何负载均衡器。 我将衷心感谢您的帮助。
我有一个工作清漆caching为我的网站,与不希望的副作用,请求与http域名caching与一个特定的url,并要求与另一个urlhttps。 这样我最终在caching中的双重对象,我想问一些如何优化这种行为的最佳做法。 详细我有nginx内的两个虚拟主机相同的域侦听端口80和443每个。 请求被代理传递给清漆: proxy_pass http://varnish:8101/VirtualHostBase/http/example.com:80/path/VirtualHostRoot/; 和 proxy_pass http://varnish:8101/VirtualHostBase/https/example.com:443/path/VirtualHostRoot/; 在varnish.vcl我检查请求的主机,并设置右后端,因为有多个。 if (req.http.host == "example.com") { set req.backend = backend_0; } 后端是一个Zope / Plone服务器。 页面caching正确varnish,但我有/VirtualHostBase/http/example.com:80/path/VirtualHostRoot/logo.png和/VirtualHostBase/https/example.com:443/path/VirtualHostRoot/一个条目在我的varnishlog(RxURL)中的logo.png。 Plone清除条目时,只清除ssl版本,因为每个login用户都必须使用https。 http条目保持到年龄无效。 是否有可能通过重写URL来将http和https请求合并成一个清漆对象? 为了节省空间和做一个成功的清除。 也许有人可以给我一个提示如何解决这个问题!
我尝试在Ubuntu 14.04 LTS,nginx上安装php5-fpm软件包。 但是我收到这个消息: Reading package lists… Done Building dependency tree Reading state information… Done Package php5-fpm is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source E: Package 'php5-fpm' has no installation candidate 我已经search了很多可能是错误的,有些答案指出并不是所有正确的path都在“sources.list”文件中。 我已取消注释path(URL)注释掉的行。 我的“sources.list”文件现在看起来像这样: […]
我有一个运行Ruby on Rails项目的瘦服务器的Nginx设置。 Nginx目前是我的SSL的端点。 我最近在web服务器上遇到了一些攻击问题,所以我决定添加CloudFlare。 它目前使用cloudflare中的“严格SSL”(客户端-CF链接和CF-web服务器链接中的ssl)。 现在,浏览我的网站时,但是当我使用Oauth的Facebook,G +等。redirect链接显示为: https://example.com:80/destination/url : https://example.com:80/destination/url :80/ destination/url(注意:80 )。 当我不使用CloudFlare时不会发生这种情况。 我能做些什么来解决这个问题? 这是CloudFlare或Nginx的问题吗? 我发现这个post ,但我不能逆向工程它nginx。 我目前的nginx-setup: server { listen 80 default; server_name .example.com; ## redirect http to https ## return 301 https://example.com$request_uri; } server { listen 443 ssl; server_name .example.com; client_max_body_size 20M; ssl_protocols TLSv1 TLSv1.1 TLSv1.2; ssl_prefer_server_ciphers on; ssl_ciphers EECDH+ECDSA+AESGCM:EECDH+aRSA+AESGCM:EECDH+ECDSA+SHA384:EECDH+ECDSA+SHA256:EECDH+aRSA+SHA384:EECDH+aRSA+SHA256:EECDH+aRSA+RC4:EECDH:EDH+aRSA:RC4:!aNULL:!eNULL:!LOW:!3DES:!MD5:!EXP:!PSK:!SRP:!DSS; ssl_certificate […]