好的,所以我最近设置了Ubuntu(node.js)w。 Nginx和SSL(letsencrypt)在我的服务器上,让一切运行完美。 我有3个服务器块。 一个将所有非www请求redirect到www 一个redirect到端口80的所有呼叫到https:// 一个设置一个反向代理服务SSL和节点,而不是。 一切都按照上面的方式工作,但是,重新启动Ubuntu后,只有第三个(服务SSL)工作,现在完全忽略了第一和第二,尽pipeNginx运行没有错误(因此为什么第三块工程)。 所以它不再redirect非www到www和http到https,但是,当我直接从https访问它的工作完美。 不知道发生了什么事情,为什么这发生后重新启动。 以下是位于/ etc / nginx / sites-enabled / default中的代码: # Redirect non-www to www server { server_name mydomain.com; return 301 https://$host$request_uri; } # HTTP – redirect all traffic to HTTPS server { listen 80; listen [::]:80 default_server ipv6only=on; return 301 https://$host$request_uri; } # HTTPS – proxy all […]
我想configurationnginx作为一个反向代理,根据传递的URI将redirect到两个不同的Kibana主机。 /redirect到标准和/october/到十月专用Kibana。 configuration( / )的第一部分工作正常,但尝试访问/october时,我得到了Too many redirections错误。 我尝试将第二部分( location /october/ )注释掉,并在第一部分中将10.10.0.3replace为localhost ,然后将其redirect到十月平台。 所以问题在于这个nginxconfiguration。 server { listen 80; server_name my.domain.io; return 301 https://$server_name; } server { listen 443 ; ssl on; ssl_certificate /etc/letsencrypt/live/my.domain.io/cert.pem; ssl_certificate_key /etc/letsencrypt/live/my.domain.io/privkey.pem; server_name my.domain.io; access_log /var/log/nginx/kibana.access.log; error_log /var/log/nginx/kibana.error.log; location / { auth_basic "Restricted"; auth_basic_user_file /etc/nginx/conf.d/kibana.htpasswd; location / { proxy_pass http://localhost:5601; proxy_http_version 1.1; proxy_set_header […]
我一直在试图解决这个如此烦人的错误,但没有奏效。 在这篇文章中,我遵循并尝试了很多方法, 当访问不带斜杠的URL时,Nginxredirect到端口8080,但仍然存在。 我正在使用nginx广告反向代理阿帕奇。 这是我的nginxconfiguration文件: server { listen 80; ## listen for ipv4 #listen [::]:80 default ipv6only=on; ## listen for ipv6 server_name domain.com *.domain.com; #access_log /var/log/nginx/localhost.access.log; location / { proxy_pass http://127.0.0.1:8080/; proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } location ~* \.(jpg|jpeg|png|gif|png|css|js|swf)$ { root /var/www/html/domain/; } } 和http http { include /etc/nginx/mime.types; default_type […]
当我尝试启用以下任一设置时,Nginx无法启动。 gzip_vary on; gzip_comp_level 6; Nginx给我下面的错误。 Job for nginx.service failed because the control process exited with error code. See "systemctl status nginx.service" and "journalctl -xe" for details. systemctl status nginx.service给了我下面的输出。 ● nginx.service – A high performance web server and a reverse proxy server Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled) Active: failed (Result: exit-code) since […]
我有几个Django应用程序,我想尝试与NGINXcaching。 我遵循这个指南。 https://www.nginx.com/blog/nginx-caching-guide/ 我使用include指令在http块中包含这一行的文件… proxy_cache_path /usr/share/nginx/cache levels=1:2 keys_zone=my cache:10m max_size=2g inactive=60m use_temp_path=off; 然后我去了sites-enabled文件夹,并将其添加到我的服务器块,这些是SSL块… server { listen 443 ssl; server_name example.com; ssl_certificate my/path/to/ssl; ssl_certificate_key my/path/to/ssl; client_max_body_size 4G; keepalive_timeout 5; # Your Django project's media files – amend as required location /media { proxy_cache my_cache; alias /home/example/media; } # your Django project's static files – amend as […]
规格:AWS EC2 Micro实例最新的Django,Python3,nginx 我刚刚在virtualenv中创build了一个Django项目。 一切都被映射出来–nginx正在捕获这些URL并将它们引导到正确的端口。 但是,我似乎在这里缺乏一些东西:每次我想访问该站点时手动运行Django服务器都没有意义,对吧? 如果我提出错误的问题,请告诉我。
我有一个网站,我想创build和删除文件夹与WordPress的网站。 结构是这样的: /wp1 /wp2 /wp3 /… 我使用nginx,我知道为了使这个工作,我必须创build多个位置块来捕获每个WordPress的网站: location /wp1 { try_files $uri $uri/ /wp1/index.php?$args; } location /wp2 { try_files $uri $uri/ /wp2/index.php?$args; } location /wp3 { try_files $uri $uri/ /wp3/index.php?$args; } … 该coonfiguration作品完美,但很难保持,所以我试图与位置的正则expression式,以便只使用一个位置块的所有网站,所以我可以删除和创build文件夹,而不必担心nginx设置: location ~ ^/wp(?<staging>\d+) { try_files $uri $uri/ /wp$staging/index.php?$args; } 但是这不起作用。 任何想法,我在想什么? 这是我的完整configuration文件: server { listen 80 default_server; listen [::]:80 default_server; server_name _; […]
在开始时,我创build了一个conf文件,当我想要访问http://www.domain.com时,它可以正常工作: server { listen 80; listen [::]:80; root /var/www/domain; index index.html server_name domain.com www.domain.com; } 然后我决定创build一个子域的另一个conf文件: server { listen 80; listen [::]:80; root /var/www/subdomain.domain; index index.html server_name subdomain.domain.com; } 现在的问题是,每当我想要访问http://www.domain.com或http://subdomain.domain.com ,在这两种情况下,结果是我应该为子域获得的页面。 新的conf文件已正确添加到site-enabled文件夹中: ln -s /etc/nginx/site-available/subdomain.domain.conf /etc/nginx/site-enabled/subdomain.domain.conf 这就是我的DNSlogging的样子: domain.com. IN A <server_ip> www.domain.com. IN A <server_ip> subdomain.domain.com. IN A <server_ip>
以下configuration: location ~ /{ try_files /$uri /$uri/ /index.php?q=$uri&$args; } 当服务器返回500时,这将尝试几件事情。它将走下去,尝试下一件事情。 但是:因为这是一种失败的forms,表单被重新提交,直到错误的代码发生的事情发生了两次。 有没有办法只尝试一个try_files或替代try_files ? 使用=500在最后是不是一个解决scheme,因为它不会显示错误页面。 编辑我添加完整的服务器块。 我有一个复杂的设置与wordpress和laravel。 WordPress在主文件夹中,而所有对caup_api和子文件夹的调用都需要进行laravel安装。 因此,我有一个softlink caup_api -> ./caup_laravel/public/ 这样我就可以使用所有的通话,通常使caup_api文件夹直接发送到laravel而不是由wordpress处理。 有问题的configuration是caup_api server { listen 80; server_name dev.myapp.org; root /var/www/html/dev.myapp.org/public; index index.html index.htm index.php; access_log /var/log/nginx/nginx_lukas23.com.access.log; error_log /var/log/nginx/nginx_lukas23.com.error.log; location = /favicon.ico { access_log off; log_not_found off; } location = /robots.txt { access_log off; log_not_found […]
我有一个NodeJS应用程序,我在端口40000上启动。我安装了Nginx,所以我可以反向代理来自各个端口的几个应用程序。 我有这个位置块: location /deduplication/v1/ { proxy_set_header Host $host; proxy_set_header X-Real-IP $remote_addr; proxy_set_header x-api-key $http_x_api_key; proxy_set_header XContent-Type $http_XContent-Type; proxy_pass_request_headers on; proxy_pass http://127.0.0.1:40000; } 但是当我用curl查询这个testing时,我得到一个404错误。 当我查看NodeJS应用程序的日志时,我看到它收到了这个: "url":"/deduplication/v1/", 这是什么? 我期待“/ deduplication / v1 /”被剥离,这样我就可以得到: / 我如何让Nginx去掉“/ deduplication / v1 /”?