我试图configurationNginx使用像github页面的代理传递的域名,并且在根域上也有一个登陆页面。 有了这个configuration代理githubages工作正常,但如果我检查example.com它也转到github页面。 我的configuration是这样的: server { listen 80 ; index index.html index.htm; server_name example.com www.example.com ; location = / { index index.html; root /home/landing/public_html ; } location / { #this work fine proxy_set_header Host enlaorbita.github.io; proxy_set_header X-Real-IP $remote_addr; proxy_pass http://user.github.io/; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } } 它必须这样做: example.com或www.example.com – >去我自己的着陆(这是行不通的) example.com/repo/ – >转到user.github.io/repo。 是的,它的作品 谢谢
我刚刚在Debian Jessie上安装了nginx,我无法启动它: $ sudo /etc/init.d/nginx start [….] Starting nginx (via systemctl): nginx.serviceJob for nginx.service failed. See 'systemctl status nginx.service' and 'journalctl -xn' for details. failed! $ systemctl status nginx.service ● nginx.service – A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled) Active: failed (Result: exit-code) since Sat 2015-08-29 17:54:15 EDT; […]
我有一个服务器,应该始终服务于https,我试图让nginx自动从httpredirect到https。 在这里阅读关于这个主题的其他问题,我写了下面的configuration: server { listen 80; return 301 https://$host$request_uri; } server { listen 443 ssl; server_name *.amazonaws.com *.mydomain.com; ssl_certificate /home/ubuntu/mysite/ssl.cert; ssl_certificate_key /home/ubuntu/mysite/ssl.key; location = /favicon.ico { access_log off; log_not_found off; } location /static/ { autoindex on; alias /home/ubuntu/mysite/__staticfiles; } location / { include proxy_params; proxy_pass http://unix:/home/ubuntu/mysite/mysite.sock; 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; […]
我正在按照此存储库中给出的configuration。 我决定将我的dockerconfiguration和实际代码保存在不同的仓库中 – 我使用Dockerfile克隆代码仓库。 我正在使用docker-machine(本地,使用Virtualbox驱动程序)和docker-compose setup。 代码回购的目录结构大致如下 – : |– bower.json |– CONTRIBUTORS |– defsec | |– defsec | | |– aws_settings.py | | |– heroku_settings.py | | |– __init__.py | | |– settings.py | | |– urls.py | | |– views.py | | `– wsgi.py | |– manage.py | |– quiz_restful | | |– […]
我在我的nginx/uwsgi/php-embedconfiguration中缺less什么? rpm -qa|grep php php-cli-5.4.16-36.el7_1.x86_64 php-xml-5.4.16-36.el7_1.x86_64 php-devel-5.4.16-36.el7_1.x86_64 php-common-5.4.16-36.el7_1.x86_64 php-5.4.16-36.el7_1.x86_64 php-xmlrpc-5.4.16-36.el7_1.x86_64 php-pdo-5.4.16-36.el7_1.x86_64 php-pgsql-5.4.16-36.el7_1.x86_64 php-embedded-5.4.16-36.el7_1.x86_64 uwsgi-plugin-php-2.0.11.1-1.el7.x86_64 /etc/nginx/conf.d/allbet.conf server { listen 8081; # root /tmp; # index index.html index.htm; server_name 127.0.0.1; location /allbet { # uwsgi_pass unix:///run/uwsgi/allbet.sock; uwsgi_pass 127.0.0.1:9081; include uwsgi_params; } } /var/log/nginx/error.log 2015/08/31 15:35:25 [error] 114498#0: *4 upstream prematurely closed connection while reading response header from […]
我有五个网站,我有三个服务器,所有运行nginx。 主服务器 负载平衡器 故障转移服务器 每个网站都有自己的主服务器,但他们都共享相同的故障转移服务器。 我的负载平衡器设置为发送所有stream量到每个网站的主服务器。 只有当主服务器closures时,负载均衡器才会将stream量发送到故障转移服务器。 对于每个网站,我在负载均衡器上都有一个单独的nginxconfiguration文件,与以下类似: upstream website { server 1.2.3.4 fail_timeout=3s max_fails=3 weight=10000; server 4.3.2.1; } server { listen 80; server_name www.websitename.com; client_max_body_size 150M; location / { proxy_pass http://website; } } server { listen 80; server_name websitename.com; client_max_body_size 150M; location / { proxy_pass http://website; } } 有了这个configuration文件,一切正常。 所有stream量都发送到主服务器,如果主服务器closures,stream量将被发送到故障转移服务器。 问题出现在故障转移服务器上。 我在故障转移服务器上有五个不同的网站,所有这些网站都在site-available目录中有自己的nginxconfiguration文件。 问题是,当stream量发送到故障转移服务器,nginx显示第一个可用的configuration文件和关联的网站,而不是正确的网站。 故障转移服务器上的每个网站configuration文件都如下面的configuration文件。 […]
我已经使用nginx作为Arch机器上的Web服务器设置了一个Gitlab实例。 我已经采取的步骤是在Arch Wiki上 。 除了每个项目页面上的下载archive.zipbutton之外,一切正在运行:当我单击该button时,我正在进入无限redirect循环。 我没有使用https或任何非标准的安装程序,没有一个日志似乎给了我有用的故障排除方法。 production.log重复: Started GET "/tdubois/Wafer-CPC/repository/archive.zip" for 131.170.94.23 at 2015-09-02 14:11:31 +1000 Processing by Projects::RepositoriesController#archive as ZIP Parameters: {"namespace_id"=>"tdubois", "project_id"=>"Wafer-CPC"} Redirected to http://domain.edu.au/tdubois/Wafer-CPC/repository/archive.zip Completed 302 Found in 5020ms (ActiveRecord: 2.0ms) sidekiq.log重复: 2015-09-02T04:11:31.059Z 31495 TID-1n7fko RepositoryArchiveWorker JID-60d166f32ebd28ba6c591547 INFO: start 2015-09-02T04:11:31.064Z 31495 TID-1n7fko RepositoryArchiveWorker JID-60d166f32ebd28ba6c591547 INFO: done: 0.005 sec nginx访问日志重复: 131.170.94.23 – – […]
我正在使用下面的nginx块来将mysite.com/blog路由到我的/ var / www / mysite / wordpress /目录: location /blog { root /var/www/mysite/wordpress; rewrite ^/blog/(.+)$ /$1 break; try_files $uri $uri/ /blog/index.php?q=$uri&$args; index index.php; location ~ \.php { fastcgi_pass 127.0.0.1:9000; include fastcgi_params; fastcgi_split_path_info ^(?:\/blog)(.+\.php)(.*); fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; } } 一切工作正常,除了mysite.com/blog/wp-admin/给我一个404错误。 访问mysite.com/blog/wp-admin/index.php按预期工作,所以它看起来像我的索引规则不起作用。 这里可能是什么问题?
在我们的服务器上,我们添加了rewrite ^(.*[^/])$ $1/ permanent; 添加一个/在所请求的URL的末尾,它的工作很好,但是我的理解是,上面的正则expression式添加一个“/”,如果URL不包含whatever.* 考虑到这一点,任何人都可以看到为什么它会忽略包含.pdf链接。 示例url是https://webaddress.com/lang/course/project/protected/project.pdf 我可以完美地查看图像。
在Django中使用Nginx,我在我的服务器configuration中有以下位置条目: location / { include uwsgi_params; uwsgi_pass 127.0.0.1:1234; } 因此,所有的根URL请求都被传递给Django。 现在,我想在根url下添加一些其他文件,例如robots.txt , favicon.ico和其他无限数量的文件。 例如/robots.txt应返回我的robots.txt文件,它位于/var/www/project/misc/ 。 我如何在Nginx中做到这一点? 我似乎无法获得用于捕获根URL“/”的多个位置。 我知道,我可以这样做: location /robots.txt { alias /var/www/project/misc/robots.txt; } 但是,我们正在讨论很多不同的文件,为它们增加一个额外的位置似乎相当笨拙。 如果有一种方法可以简单地提供根URL下的整个目录,那就更好了。