这是我的nginxconfiguration: server { listen 80; server_name example.com; location /assets { root /var/www/frappe/sites/assets; try_files $uri $uri/ =404; } location / { proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_set_header Host $http_host; proxy_set_header X-NginX-Proxy true; proxy_pass http://127.0.0.1:8000; proxy_redirect off; } } 我想让/ assets目录由NGINX处理,而其他所有的东西都由运行在8000上的python服务器处理。但是,我仍然在资产目录上获得了404。 我究竟做错了什么? assets目录可以通过www-data读取。
我只是从Apache迁移到Nginx并尝试设置重写规则。 我有一个虚拟主机,这是虚拟主机的结构 /var/www/name-of-virtual-host/ ├── wp1 │ ├── wp-admin │ ├── wp-content │ └── wp-includes └── wp2 ├── wp-admin ├── wp-content └── wp-includes 正如你所看到的,我在不同的文件夹中有2个不同的WordPress安装 所以我试图创build一个重写规则来处理这两个WP。 这是我的位置定义: location / { try_files @missing $uri; } location @missing { rewrite ^/([az-])(/.*)$ /$1/index.php last; } location ~ \.php$ { fastcgi_split_path_info ^(.+\.php)(/.+)$; # NOTE: You should have "cgi.fix_pathinfo = 0;" in […]
与我有关如何使用nginx设置反向代理的问题相关,我现在被困在设置一个额外需要SSL连接。 我有docker集装箱提供映射的SSL端口4430到我的主机系统。 networking服务器正在使用自签名证书。 在我的/etc/hosts文件中,我定义了: 127.0.0.1 app.local 而我的nginx服务器configuration如下所示: server { listen 80; server_name app.local; location / { return https://$host$request_uri; } } server { listen 443; server_name app.local; location / { proxy_pass https://127.0.0.1:4430; } } 当我使用https://127.0.0.1::4430访问我的webapp时,它工作正常。 我第一次接到证书的警告,然后我必须允许。 然而,当通过http://app.local或https://app.local ,我的浏览器显示: SSL connection error ERR_SSL_PROTOCOL_ERROR 我也期待证书警告出现,然后我可以允许。 在nginx中使用SSL时如何获得反向代理?
目前我使用nginx作为通过https的反向代理,所有代理本身都是通过https。 SSL终止发生在Nginx上,而且由于stream量已经超过了https,所以在继续之前,它会再次被encryption。 我的第一个直觉是,我面向公众的服务器必须使用签名证书,并使用nginx的SSL直通。 原来nginx不允许你这样做。 所以我开始看haproxy,因为它可以做SSL直通。 经过大量的阅读,我开始想知道这是否真的很重要。 我可以在自己的networking中使用自签名authentication。 是否有理由在我的服务器上使用nginx / haproxy上的相同证书? 是否有任何理由不使用自签名证书进行内部通信?
我打算在我的服务器上安装新的环境,与HHVM一起使用Nginx webserver。 我安装了两个,然后来到MariaDB并安装它。 我可以通过点击IP地址来确认服务器的工作: 欢迎来到nginx! 然后我需要安装一个基于Web的客户端来pipe理数据库。 我知道phpMyAdmin非常适合Apache和Litespeed,但是当我跟着很多关于在Nginx旁边安装phpMyAdmin的文章时,步骤几乎是一样的。 但问题是做apt-get install phpmyadmin也将安装Apache: The following extra packages will be installed: apache2 apache2-bin apache2-data dbconfig-common libapache2-mod-php5 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libjs-codemirror libjs-jquery libjs-jquery-cookie libjs-jquery-event-drag libjs-jquery-metadata libjs-jquery-mousewheel libjs-jquery-tablesorter libjs-jquery-ui libjs-underscore php-gettext php5 php5-common php5-json php5-mcrypt php5-mysql 通过确认安装,它将安装并启用Apache模块: […] Enabling module mpm_event. Enabling module authz_core. Enabling module authz_host. Enabling module authn_core. […]
问题 我有一个服务于3个子域的nginx服务器,比如a.example.com , b.example.com和c.example.com 。 configuration文件分别是a.example.com.conf , b.example.com.conf和c.example.com.conf 。 它们存储在/etc/nginx/sites-available /etc/nginx/sites-enabled并从/etc/nginx/sites-enabled软链接。 在configuration文件中,每个server子句都有相应的server_name指令。 如果重要的话,所有三个子域名都使用Let's Encrypt使用相同的SSL证书问题 (工作正常)。 当b.example.com.conf从sites-enabled删除时,我希望在尝试浏览到它时出现错误消息。 令人惊讶的是,nginx将stream量redirect到a.example.com 。 实际上, /etc/nginx/sites-enabled了/etc/nginx/sites-enabled (包括机器IP)的每个传入连接都没有匹配的服务器名称,将被路由到a.example.com 。 如何configurationnginx来使server指令独占,这样对b.example.com请求永远不会被a.example.com ? 组态 a.example.com.conf server { listen 443 ssl; server_name a.example.com; ssl_certificate /etc/letsencrypt/live/a.example.com/fullchain.pem; ssl_certificate_key /etc/letsencrypt/live/a.example.com/privkey.pem; location / { proxy_pass http://localhost:8080; } } b.example.com.conf server { listen 443 ssl; server_name b.example.com; # I'm using […]
在带有HHVM(HipHop VM 3.14.1)和Nginx(nginx / 1.10.1)的Ubuntu 14.04.4 LTS上, 我尝试在我的虚拟主机中启用如下所示的HTTP / 2 server { listen 443 ssl http2 default_server; listen [::]:443 ssl http2 default_server; root /var/www/mydomain; index index.html index.htm index.php; server_name mydomain.com; ssl_certificate /etc/nginx/ssl/www_mydomain_com.pem; ssl_certificate_key /etc/nginx/ssl/server.key; access_log /var/log/nginx/localhost.laravel-access.log; error_log /var/log/nginx/locahost.laravel-error.log error; charset utf-8; location / { try_files $uri $uri/ /index.php?$query_string; } location = /favicon.ico { log_not_found off; […]
稍后编辑经过大量的故障排除之后,实际的问题在server_name指令之后是一个缺失的分号。 nginx -t -c /etc/nginx/nginx.conf没有抓住它。 如果遇到与此相似的情况,请仔细检查拼写错误。 原来的问题如下: 我正在使用nginx 1.10.0build立一个基于ubuntu 16.04的新服务器。 具体问题是,虽然我的新configuration基本上与使用nginx 1.4.4的ubuntu 13.10服务器上的旧nginxconfiguration相匹配,但nginx 1.10.0仅创buildipv4或ipv6 worker,但不能同时configuration。 旧的服务器上不存在此行为。 不知道还有什么要尝试在这一点上。 我已经validation了我的nginx安装是使用ipv6构build的。 nginx version: nginx/1.10.0 (Ubuntu) built with OpenSSL 1.0.2g-fips 1 Mar 2016 TLS SNI support enabled configure arguments: –with-cc-opt='-g -O2 -fPIE -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2' –with-ld-opt='-Wl,-Bsymbolic-functions -fPIE -pie -Wl,-z,relro -Wl,-z,now' –prefix=/usr/share/nginx –conf-path=/etc/nginx/nginx.conf –http-log-path=/var/log/nginx/access.log –error-log-path=/var/log/nginx/error.log –lock-path=/var/lock/nginx.lock –pid-path=/run/nginx.pid –http-client-body-temp-path=/var/lib/nginx/body […]
我正在尝试在我的服务器上安装LetsEncrypt (我拥有root用户的SSH访问权限),用于staging.dnslaude.com – 这是一个可公开访问的域,指向213.212.81.89 。 服务器运行ubuntu 16.04 ,和一个nginxnetworking服务器。 下面是nginxconfiguration: server { listen 80; server_name staging.dnslaude.com; root /path/to/webroot; location ^~ /.well-known/acme-challenge/ { try_files $uri $uri/ =404; } rewrite ^(.*) https://$host$1 permanent; } server { listen 443; ssl on; ssl_certificate /path/to/self/signed/certificate.crt; ssl_certificate_key /path/to/key.key; server_name staging.dnslaude.com; root /path/to/webroot; # …. location ^~ /.well-known/acme-challenge/ { try_files $uri $uri/ =404; […]
我想在一天中的某个时段禁用对应用程序的访问。 在Nginx中可以这样做吗? if(hour > '04:00:00' && hour < '05:00:00') { root /var/www/maintenance; } else { root /var/www/site; }