Articles of nginx

Rewirte规则在Nginx中

我把conisder移到了Nginx上,但我想问你是否可以重写Url到这个模式中,如果你能帮我一下: 像example.com/username这样的url到profile.php?u = username 。 但是,那么我会在访问其他页面如home.php时遇到问题 一个URL像example.com/questions/102039/that-question into questions.php?quid = 102039 非常感谢你!

使用Nginx Proxy进行子域代理/重写

我想把m.example.com和这些请求用nginx指向example.com/mobile/。 (相同的nginx服务器将服务于example.com) 有人可以帮我用我需要的configuration吗? 如果需要,我可以发布我的nginx.conf,但我认为它是这样的: location / {rewrite /([^ /] +)/ mobile / $ 1 break; proxy_pass http://127.0.0.1 ; } 我在正确的场地吗?

当从外部configuration文件包含fastcgi_param SCRIPT_NAME时,fastcgi_param SCRIPT_NAME不起作用

在我的服务器上升级nginx之后,所有PHP站点都停止工作。 之前,我在“fastcgi_params”这个文件中有这个: fastcgi_param SCRIPT_NAME $fastcgi_script_name; 然后PHP站点的configuration文件里面有一个这样的块: location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; include fastcgi_params; } 但是,这不再起作用。 它只适用于如果我在每个站点的configuration文件中有这个: location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } 我必须在这里设置SCRIPT_FILENAME,而不是在“fastcgi_params”中。 它现在还必须在它前面有$ document_root。 如果在包含的fastcgi_params文件中设置,“$ document_root $ fastcgi_script_name”和“$ fastcgi_script_name”都不起作用。 我并不担心我现在不得不用$ document_root(但我很好奇,如果有人知道为什么会打破或为什么它以前工作)prepend它,但我宁愿保持fastcgi_params文件中的常见function为简单,所以我想知道为什么这是行不通的。

提供静态文件失败 – nginx

我一直在寻找和尝试整个晚上,但没有成功。 我configurationnginx来服务我的静态文件,并代理所有其他stream量: server { listen 80; server_name example.com; access_log /home/boudewijn/www/bbt/brouwers/logs/access.log; error_log /home/boudewijn/www/bbt/brouwers/logs/error.log; location / { proxy_pass http://127.0.0.1:8080; include /etc/nginx/proxy.conf; } location /media/ { root /home/boudewijn/www/bbt/brouwers/; } } 代理传递没有问题,但是当我去example.com/media/或尝试访问那里的任何testing文件时,它没有成功。 我注意到根和别名之间的区别,我的媒体文件夹存在,我注意到后面的斜线,但是当我尝试访问我的静态媒体文件时仍然得到了404。 任何帮助?

Capistrano需要root密码才能部署 – 不好

我正在使用Capistrano部署到我的VPS(Ubuntu的Linode),似乎需要我的root用户的密码才能完成部分部署。 这是不好的,因为我看到它。 (我与nginx和乘客滚动。) 我recursion地部署目录和git仓库。 我的deploy.rb文件中唯一的exception是我运行bundle install和rake db:在deploy:update_code之后进行迁移。 下面是从部署相对(我相信)到根密码请求的输出: * executing `deploy' * executing `deploy:update' ** transaction: start * executing `deploy:update_code' updating the cached checkout on all servers executing locally: "git ls-remote deploy@mydomain:~/myapp.git master" * executing "if [ -d /home/apps/myapp/shared/cached-copy ]; then cd /home/apps/myapp/shared/cached-copy && git fetch origin && git reset –hard 8ea422656949f90cc27fd17cb31d68bbaeb33c6e && git clean […]

如何解决Nginxconfiguration与多个Unicorn主机的工作?

我没有问题在不同的Unix套接字和端口上实例化多个独angular兽实例。 工作正常,如果我做url:端口。 我的问题正确地格式化nginx.conf允许multipe上游条件。 无论我做什么似乎都不起作用。 一个例子是好的工作正常。 倍数给我一个“”上游“指令是不允许在这里错误 我正在使用独angular兽网站的基本nginx样本。 并以不同的条件加倍上游地区。 每个都是http集的一部分。 任何帮助将是惊人的!

nginx子域redirect到URL

我有一个服务器运行nginx + php5-fpm与wordpress安装。 我的网站在example.com上提供,我想configurationadmin.example.com来指向我的网站贡献者example.com/wp-admin。 如何configuration我的服务器{}块来执行此操作?

Nginx的html文件夹

文件夹“/ usr / share / nginx / html”中的文件属于用户“nginx”(或root?),主用户“2x2p1p”不能修改这些文件,那么最好的办法是: 1 – 更改用户和组“/ usr / share / nginx / html”(chown -R 2x2p1p:2x2p1p / usr / share / nginx / html) 2 – 将用户“2x2p1p”添加到组“nginx”(usermod -a -G nginx 2x2p1p; chmod -R 664 / usr / share / nginx / html) 那么,我该怎么办? 谢谢

configuration问题与nginx,乘客和Ruby on Rails的“没有这样的文件加载 – configuration/环境”

我最近得到了一个Linode,并在Debian 5上跟随了关于如何在Nginx上设置Ruby On Rails的指南。 一切似乎设置正确(没有错误或问题后,该指南)。 我已经上传了我在本地工作的Ruby应用程序,更新了nginx.conf文件指向应用程序,现在出现错误: no such file to load — config/environment 请看这个屏幕捕获错误的全部细节。 我已经尝试更改environment.rb文件的权限。 我想我错过了一些非常基本的东西。 对于什么是值得的,该网站在Mac环境本地工作。 这是我的nginx日志的一个片段。 这里是我的nginx conf文件中的网站: server { listen 80; server_name *.mydomain.com; root html/simple_cms/public; passenger_enabled on; passenger_use_global_queue on; } 我在Linux环境和Ruby开发人员都是一个完整的新手。 所以,任何意见将很好地采取和非常感谢!

我在哪里可以find彻底的nginx文档?

当我们迁移到新的服务器/ IP地址时,我想使用nginx作为现有主机上的代理。 我曾经说过要使用nginx的速度。 但是文件似乎几乎不存在。 很多应用指南,但在nginx维基上没有深入的内容: 句法 set命令 如果有兴趣的话,我正在专门研究如何向新主机发送请求,以便它知道原始主机要求的是什么。 可能通过一个新的头,可能通过设置一个查询stringparam.n